// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: get_nmea_time()
void get_nmea_time()
{
double ftime;
int time;

   // get a time field from a NMEA message

   if(rcvr_type == BRANDY_RCVR) {  // we use the brandywine time and date message
      get_msg_field();
   }
   else if(get_msg_field()) {  // time
      ftime = atof(msg_field);  // time field can be floating point
      time = (int) ftime;
      pri_hours = hours = (time / 10000);
      pri_minutes = minutes = ((time / 100) % 100);
      pri_seconds = seconds = ((time / 1) % 100);
      pri_frac = raw_frac = ftime - (double) time;
//vvvv   time_flags |= TFLAGS_UTC;  // UTC based time
      if(timing_mode == TMODE_GPS) {  // convert utc time to gps time
         utc_to_gps();
      }
      time_flags &= (~TFLAGS_INVALID);
   }
   else if(1) { // empty time field, use system clock and flag as invalid time
      get_clock_time();
      hours = pri_hours = clk_hours;
      minutes = pri_minutes = clk_minutes;
      seconds = pri_seconds = clk_seconds;
      pri_frac = raw_frac = clk_frac;
      time_flags |= (~TFLAGS_INVALID);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x196fa5(%rip), %rax    # 0x2188d0
movq (%rax), %rbx
callq 0x811da
cmpq $0x40000, %rbx          # imm = 0x40000
je 0x81ace
testl %eax, %eax
je 0x81a42
leaq 0x2ba0f1(%rip), %rdi    # 0x33ba40
callq 0x9470
cvttsd2si %xmm0, %eax
cltq
imulq $0x68db8bad, %rax, %rcx # imm = 0x68DB8BAD
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x2c, %rcx
addl %edx, %ecx
leaq 0x28bb5b(%rip), %rdx    # 0x30d4d0
movl %ecx, (%rdx)
leaq 0x28bb8a(%rip), %rdx    # 0x30d508
movl %ecx, (%rdx)
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
movslq %ecx, %rcx
imulq $0x51eb851f, %rcx, %rdx # imm = 0x51EB851F
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x25, %rdx
addl %esi, %edx
imull $0x64, %edx, %edx
imull $0x64, %ecx, %esi
subl %edx, %ecx
leaq 0x28bb12(%rip), %rdx    # 0x30d4cc
movl %ecx, (%rdx)
leaq 0x28bb41(%rip), %rdx    # 0x30d504
movl %ecx, (%rdx)
subl %esi, %eax
leaq 0x28bafa(%rip), %rcx    # 0x30d4c8
movl %eax, (%rcx)
leaq 0x28bb29(%rip), %rcx    # 0x30d500
movl %eax, (%rcx)
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
subsd %xmm1, %xmm0
leaq 0x28baf4(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
leaq 0x28bb21(%rip), %rax    # 0x30d518
movsd %xmm0, (%rax)
leaq 0x28babb(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
jne 0x81a31
leaq 0x28bd1a(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
callq 0x5c907
leaq 0x28ba83(%rip), %rax    # 0x30d4a4
andb $-0x2, (%rax)
leaq 0x28b9a1(%rip), %rax    # 0x30d3cc
movl $0x1, (%rax)
leaq 0x28ba6c(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
andl $-0x5, %eax
jmp 0x81ac5
callq 0xa495
leaq 0x28bc7e(%rip), %rax    # 0x30d6cc
movl (%rax), %eax
leaq 0x28bab1(%rip), %rcx    # 0x30d508
movl %eax, (%rcx)
leaq 0x28ba70(%rip), %rcx    # 0x30d4d0
movl %eax, (%rcx)
leaq 0x28bc67(%rip), %rax    # 0x30d6d0
movl (%rax), %eax
leaq 0x28ba92(%rip), %rcx    # 0x30d504
movl %eax, (%rcx)
leaq 0x28ba51(%rip), %rcx    # 0x30d4cc
movl %eax, (%rcx)
leaq 0x28bc50(%rip), %rax    # 0x30d6d4
movl (%rax), %eax
leaq 0x28ba73(%rip), %rcx    # 0x30d500
movl %eax, (%rcx)
leaq 0x28ba32(%rip), %rcx    # 0x30d4c8
movl %eax, (%rcx)
leaq 0x28bc39(%rip), %rax    # 0x30d6d8
movsd (%rax), %xmm0
leaq 0x28ba36(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
leaq 0x28ba63(%rip), %rax    # 0x30d518
movsd %xmm0, (%rax)
leaq 0x28b9e4(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
orl $-0x5, %eax
leaq 0x28b9d8(%rip), %rcx    # 0x30d4a4
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq