// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_ubx_utc()
void parse_ubx_utc()
{
u32 gps_msec;
double accu;

   // get utc time
   log_packet_id("UBX_UTC");

   gps_msec = tsip_dword();
   pri_tow = tow = this_tow = (gps_msec / 1000);
   if(have_tow == 0) need_redraw = 2014;
   have_tow = 2;
   survey_tow = this_tow;
   accu = (double) tsip_dword();  // time error estimate in nanoseconds

   pri_frac = (double) (int) tsip_dword();  // !!!!!! can be negative
   pri_frac /= 1.0E9;
   raw_frac = pri_frac;

   pri_year = year = tsip_word();
   pri_month = month = tsip_byte();
   pri_day = day = tsip_byte();
   pri_hours = hours = tsip_byte();
   pri_minutes = minutes = tsip_byte();
   pri_seconds = seconds = tsip_byte();
   tsip_byte();  // validity flags

//if(log_file) fprintf(log_file, "  %02d:%02d:%02d.%f  %04d/%02d/%02d  tow:%d\n", 
//pri_hours,pri_minutes,pri_seconds, pri_frac, pri_year,pri_month,pri_day, tow); // zorky

   if(accu == (double) (u32) 0xFFFFFFFF) accu = 0.0;  // filter bogus power-up value
   pps_offset = (accu);
   have_pps_offset = 3;
   have_rcvr_pps = 3;
//adadad   if(jitter_adev == 0) do_pps_adev(pps_offset);

   osc_offset = pri_frac*1.0E9;
   have_osc_offset = 3;
   have_rcvr_osc = 3;
//adadad   if(jitter_adev == 0) do_osc_adev(osc_offset);

   time_flags |= TFLAGS_UTC;  // UTC based time
   have_timing_mode = 1;
   have_rcvr_tmode = 1;

   if(timing_mode == TMODE_GPS) {     // convert utc time to gps time
      utc_to_gps();
   }
   else {
      adjust_rcvr_time(0.0);  // incorporarte possibly negative fractional second into time variables
   }

   update_gps_screen(1000);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x87d67(%rip), %rdi     # 0x10e5de
callq 0x520bf
callq 0x51cf3
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divl %ecx
leaq 0x270eaf(%rip), %rcx    # 0x2f7740
movl %eax, (%rcx)
leaq 0x270ea2(%rip), %rcx    # 0x2f773c
movl %eax, (%rcx)
leaq 0x270ea1(%rip), %rcx    # 0x2f7744
movl %eax, (%rcx)
leaq 0x270a7c(%rip), %rcx    # 0x2f7328
cmpl $0x0, (%rcx)
jne 0x868be
leaq 0x17bf8c(%rip), %rdx    # 0x202844
movl $0x7de, (%rdx)          # imm = 0x7DE
movl $0x2, (%rcx)
movl %eax, %eax
leaq 0x270e83(%rip), %rcx    # 0x2f7750
movq %rax, (%rcx)
callq 0x51cf3
movl %eax, %ebx
callq 0x51cf3
cvtsi2sd %eax, %xmm0
divsd 0x6c740(%rip), %xmm0    # 0xf3028
leaq 0x270c29(%rip), %r14    # 0x2f7518
movsd %xmm0, (%r14)
leaq 0x270be5(%rip), %rax    # 0x2f74e0
movsd %xmm0, (%rax)
callq 0x51c63
movzwl %ax, %eax
leaq 0x270bce(%rip), %rcx    # 0x2f74dc
movl %eax, (%rcx)
leaq 0x270bfd(%rip), %rcx    # 0x2f7514
movl %eax, (%rcx)
callq 0x51c47
movzbl %al, %eax
leaq 0x270bb0(%rip), %rcx    # 0x2f74d8
movl %eax, (%rcx)
leaq 0x270bdf(%rip), %rcx    # 0x2f7510
movl %eax, (%rcx)
callq 0x51c47
movzbl %al, %eax
leaq 0x270b92(%rip), %rcx    # 0x2f74d4
movl %eax, (%rcx)
leaq 0x270bc1(%rip), %rcx    # 0x2f750c
movl %eax, (%rcx)
callq 0x51c47
movzbl %al, %eax
leaq 0x270b74(%rip), %rcx    # 0x2f74d0
movl %eax, (%rcx)
leaq 0x270ba3(%rip), %rcx    # 0x2f7508
movl %eax, (%rcx)
callq 0x51c47
movzbl %al, %eax
leaq 0x270b56(%rip), %rcx    # 0x2f74cc
movl %eax, (%rcx)
leaq 0x270b85(%rip), %rcx    # 0x2f7504
movl %eax, (%rcx)
callq 0x51c47
movzbl %al, %eax
leaq 0x270b38(%rip), %rcx    # 0x2f74c8
movl %eax, (%rcx)
leaq 0x270b67(%rip), %rcx    # 0x2f7500
movl %eax, (%rcx)
callq 0x51c47
xorpd %xmm0, %xmm0
cmpl $-0x1, %ebx
je 0x869b0
movl %ebx, %eax
cvtsi2sd %rax, %xmm0
leaq 0x26fe01(%rip), %rax    # 0x2f67b8
movsd %xmm0, (%rax)
leaq 0x270876(%rip), %rax    # 0x2f7238
pushq $0x3
popq %rcx
movl %ecx, (%rax)
leaq 0x270876(%rip), %rax    # 0x2f7244
movl %ecx, (%rax)
movsd 0x6c650(%rip), %xmm0    # 0xf3028
mulsd (%r14), %xmm0
leaq 0x26fddc(%rip), %rax    # 0x2f67c0
movsd %xmm0, (%rax)
leaq 0x270845(%rip), %rax    # 0x2f7234
movl %ecx, (%rax)
leaq 0x270850(%rip), %rax    # 0x2f7248
movl %ecx, (%rax)
leaq 0x270aa3(%rip), %rax    # 0x2f74a4
orb $0x1, (%rax)
leaq 0x2709c1(%rip), %rax    # 0x2f73cc
pushq $0x1
popq %rcx
movl %ecx, (%rax)
leaq 0x2709b9(%rip), %rax    # 0x2f73d0
movl %ecx, (%rax)
leaq 0x270a9d(%rip), %rax    # 0x2f74bd
cmpb $0x0, (%rax)
je 0x86a30
xorpd %xmm0, %xmm0
callq 0x55462
jmp 0x86a35
callq 0x554d3
popq %rbx
popq %r14
popq %rbp
jmp 0x694f6