// File: /workspace/github_cpp_makefile_star2_O3/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 0x19708e(%rip), %rax    # 0x2188d0
movq (%rax), %rbx
callq 0x810b1
cmpq $0x40000, %rbx          # imm = 0x40000
je 0x819ed
testl %eax, %eax
je 0x81930
leaq 0x2ba1da(%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 0x28bc44(%rip), %rdx    # 0x30d4d0
movl %ecx, (%rdx)
leaq 0x28bc73(%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 0x28bbfb(%rip), %rdx    # 0x30d4cc
movl %ecx, (%rdx)
leaq 0x28bc2a(%rip), %rdx    # 0x30d504
movl %ecx, (%rdx)
subl %esi, %eax
leaq 0x28bbe3(%rip), %rcx    # 0x30d4c8
movl %eax, (%rcx)
leaq 0x28bc12(%rip), %rcx    # 0x30d500
movl %eax, (%rcx)
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
subsd %xmm1, %xmm0
leaq 0x28bbdd(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
leaq 0x28bc0a(%rip), %rax    # 0x30d518
movsd %xmm0, (%rax)
leaq 0x28bba4(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
je 0x819b5
leaq 0x28bb7b(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
jmp 0x819e1
callq 0xa477
leaq 0x28bd90(%rip), %rax    # 0x30d6cc
movl (%rax), %eax
leaq 0x28bbc3(%rip), %rcx    # 0x30d508
movl %eax, (%rcx)
leaq 0x28bb82(%rip), %rcx    # 0x30d4d0
movl %eax, (%rcx)
leaq 0x28bd79(%rip), %rax    # 0x30d6d0
movl (%rax), %eax
leaq 0x28bba4(%rip), %rcx    # 0x30d504
movl %eax, (%rcx)
leaq 0x28bb63(%rip), %rcx    # 0x30d4cc
movl %eax, (%rcx)
leaq 0x28bd62(%rip), %rax    # 0x30d6d4
movl (%rax), %eax
leaq 0x28bb85(%rip), %rcx    # 0x30d500
movl %eax, (%rcx)
leaq 0x28bb44(%rip), %rcx    # 0x30d4c8
movl %eax, (%rcx)
leaq 0x28bd4b(%rip), %rax    # 0x30d6d8
movsd (%rax), %xmm0
leaq 0x28bb48(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
leaq 0x28bb75(%rip), %rax    # 0x30d518
movsd %xmm0, (%rax)
leaq 0x28baf6(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
orl $-0x5, %eax
jmp 0x819e4
leaq 0x28bd6c(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
callq 0x5c7ed
leaq 0x28bad5(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
andl $-0x2, %eax
leaq 0x28b9f1(%rip), %rcx    # 0x30d3cc
movl $0x1, (%rcx)
andl $-0x5, %eax
leaq 0x28bab9(%rip), %rcx    # 0x30d4a4
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq