// File: /workspace/github_cpp_makefile_star2_O1/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 0x90dc2(%rip), %rdi     # 0x1245b6
callq 0x58e77
callq 0x589b0
movl %eax, %eax
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
shrq $0x26, %rax
leaq 0x279f2e(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
leaq 0x279f21(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
leaq 0x279f20(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x279afb(%rip), %rcx    # 0x30d328
cmpl $0x0, (%rcx)
jne 0x9383f
leaq 0x18500b(%rip), %rdx    # 0x218844
movl $0x7de, (%rdx)          # imm = 0x7DE
movl $0x2, (%rcx)
movl %eax, %eax
leaq 0x279f02(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
callq 0x589b0
movl %eax, %ebx
callq 0x589b0
cvtsi2sd %eax, %xmm0
divsd 0x757bf(%rip), %xmm0    # 0x109028
leaq 0x279ca8(%rip), %r14    # 0x30d518
movsd %xmm0, (%r14)
leaq 0x279c64(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
callq 0x588f0
movzwl %ax, %eax
leaq 0x279c4d(%rip), %rcx    # 0x30d4dc
movl %eax, (%rcx)
leaq 0x279c7c(%rip), %rcx    # 0x30d514
movl %eax, (%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x938b0
leaq 0x1ab6c3(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
leaq 0x279c1e(%rip), %rcx    # 0x30d4d8
movl %eax, (%rcx)
leaq 0x279c4d(%rip), %rcx    # 0x30d510
movl %eax, (%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x938db
leaq 0x1ab698(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
leaq 0x279bef(%rip), %rcx    # 0x30d4d4
movl %eax, (%rcx)
leaq 0x279c1e(%rip), %rcx    # 0x30d50c
movl %eax, (%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x93906
leaq 0x1ab66d(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
leaq 0x279bc0(%rip), %rcx    # 0x30d4d0
movl %eax, (%rcx)
leaq 0x279bef(%rip), %rcx    # 0x30d508
movl %eax, (%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x93931
leaq 0x1ab642(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
leaq 0x279b91(%rip), %rcx    # 0x30d4cc
movl %eax, (%rcx)
leaq 0x279bc0(%rip), %rcx    # 0x30d504
movl %eax, (%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9395c
leaq 0x1ab617(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
leaq 0x279b62(%rip), %rcx    # 0x30d4c8
movl %eax, (%rcx)
leaq 0x279b91(%rip), %rcx    # 0x30d500
movl %eax, (%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x93987
leaq 0x1ab5ec(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
xorpd %xmm0, %xmm0
cmpl $-0x1, %ebx
je 0x9399a
movl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
leaq 0x278e17(%rip), %rax    # 0x30c7b8
movsd %xmm0, (%rax)
leaq 0x27988c(%rip), %rax    # 0x30d238
movl $0x3, %ecx
movl %ecx, (%rax)
leaq 0x27988a(%rip), %rax    # 0x30d244
movl %ecx, (%rax)
movsd (%r14), %xmm0
mulsd 0x7565f(%rip), %xmm0    # 0x109028
leaq 0x278df0(%rip), %rax    # 0x30c7c0
movsd %xmm0, (%rax)
leaq 0x279859(%rip), %rax    # 0x30d234
movl %ecx, (%rax)
leaq 0x279864(%rip), %rax    # 0x30d248
movl %ecx, (%rax)
leaq 0x279ab7(%rip), %rbx    # 0x30d4a4
orb $0x1, (%rbx)
leaq 0x2799d5(%rip), %r14    # 0x30d3cc
movl $0x1, %eax
movl %eax, (%r14)
leaq 0x2799ca(%rip), %rcx    # 0x30d3d0
movl %eax, (%rcx)
leaq 0x279aae(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
je 0x93a1f
xorpd %xmm0, %xmm0
callq 0x5c907
jmp 0x93a3c
leaq 0x279d02(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
callq 0x5c907
andb $-0x2, (%rbx)
movl $0x1, (%r14)
popq %rbx
popq %r14
popq %rbp
jmp 0x7327e