// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: set_cs_time(char)
void set_cs_time(char mode)
{
double mjd;

   // sets the H5071 date and time from the system clock.
   // The 5071A must be in REMOTE mode for this to work
   if(read_only) return;

   if(rcvr_type == CS_RCVR) {
      need_cs_timeset = 0;
      get_clock_time();   // get system clock time in UTC

      if(mode == 'L') {  // set to local (displayed) time
         adjust_tz(987);
         clk_year = pri_year;
         clk_month = pri_month;
         clk_day = pri_day;
         clk_hours = pri_hours;
         clk_minutes = pri_minutes;
         clk_seconds = pri_seconds;
         clk_frac = pri_frac;
      }
      else if(mode == 'U') {  // set to UTC time
      }
      else return;

      mjd = jdate(clk_year,clk_month,clk_day) - JD_MJD;

      sprintf(out, "PTIM:TIME %d,%d,%d", clk_hours,clk_minutes,clk_seconds);
      send_polled_cmd(out, CS_TIME_MSG);

      sprintf(out, "PTIM:MJD %d", (int) (mjd+0.50));
      send_polled_cmd(out, CS_MJD_MSG);

      BEEP(511);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x28db0c(%rip), %rax    # 0x32101a
cmpb $0x0, (%rax)
jne 0x93561
leaq 0x16f3b6(%rip), %rax    # 0x2028d0
cmpq $0x20000, (%rax)        # imm = 0x20000
jne 0x93561
movl %edi, %ebx
leaq 0x1714e4(%rip), %rax    # 0x204a10
movb $0x0, (%rax)
callq 0xa386
movsbl %bl, %eax
cmpl $0x4c, %eax
je 0x93568
cmpl $0x55, %eax
jne 0x93561
leaq 0x264180(%rip), %rax    # 0x2f76c8
movl (%rax), %edi
leaq 0x26416f(%rip), %rax    # 0x2f76c0
movl (%rax), %esi
leaq 0x26416a(%rip), %rax    # 0x2f76c4
movl (%rax), %edx
jmp 0x935f4
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x3db, %edi            # imm = 0x3DB
callq 0xcf298
leaq 0x263f9b(%rip), %rax    # 0x2f7514
movl (%rax), %edi
leaq 0x264146(%rip), %rax    # 0x2f76c8
movl %edi, (%rax)
leaq 0x263f85(%rip), %rax    # 0x2f7510
movl (%rax), %esi
leaq 0x26412c(%rip), %rax    # 0x2f76c0
movl %esi, (%rax)
leaq 0x263f6f(%rip), %rax    # 0x2f750c
movl (%rax), %edx
leaq 0x26411e(%rip), %rax    # 0x2f76c4
movl %edx, (%rax)
leaq 0x263f59(%rip), %rax    # 0x2f7508
movl (%rax), %eax
leaq 0x264114(%rip), %rcx    # 0x2f76cc
movl %eax, (%rcx)
leaq 0x263f43(%rip), %rax    # 0x2f7504
movl (%rax), %eax
leaq 0x264106(%rip), %rcx    # 0x2f76d0
movl %eax, (%rcx)
leaq 0x263f2d(%rip), %rax    # 0x2f7500
movl (%rax), %eax
leaq 0x2640f8(%rip), %rcx    # 0x2f76d4
movl %eax, (%rcx)
leaq 0x263f33(%rip), %rax    # 0x2f7518
movsd (%rax), %xmm0
leaq 0x2640e8(%rip), %rax    # 0x2f76d8
movsd %xmm0, (%rax)
callq 0xc2f07
addsd 0x622f7(%rip), %xmm0    # 0xf58f8
movsd %xmm0, -0x10(%rbp)
leaq 0x2640bf(%rip), %rax    # 0x2f76cc
movl (%rax), %edx
leaq 0x2640ba(%rip), %rax    # 0x2f76d0
movl (%rax), %ecx
leaq 0x2640b5(%rip), %rax    # 0x2f76d4
movl (%rax), %r8d
leaq 0x292bf7(%rip), %rbx    # 0x326220
leaq 0x7c378(%rip), %rsi     # 0x10f9a8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x12c, %esi            # imm = 0x12C
callq 0x64f01
movsd -0x10(%rbp), %xmm0
addsd 0x5fa14(%rip), %xmm0    # 0xf3068
cvttsd2si %xmm0, %edx
leaq 0x7c35c(%rip), %rsi     # 0x10f9bb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x12d, %esi            # imm = 0x12D
callq 0x64f01
movl $0x1ff, %edi            # imm = 0x1FF
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x9d23