// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpzda(int)
void parse_gpzda(int system)
{
int tz_hours;
int tz_minutes;
double tz_adjust;
double jd;


   if((rcvr_type == Z12_RCVR) && ZDA_TIME) {
      get_norcvr_message();
      return;
   }

   if((system & system_mask) == 0) return;

   have_gpzda = system;

   tz_hours = 0;      // time zone adjustment
   tz_minutes = 0;
   tz_adjust = 0.0;

   last_was_gsv = 0;

   // Note: OSX45xx corrupts the ZDA message if the receiver has rollover issues
   get_nmea_time();
   if(get_msg_field()) {
      pri_day = day = atoi(msg_field);
      if((pri_day < 1) || (pri_day > 31)) ;
      else have_nmea_date |= 0x01;
   }
   if(get_msg_field()) {
      pri_month = month = atoi(msg_field);
      if((pri_month < 1) || (pri_month > 12)) ;
      else have_nmea_date |= 0x02;
   }
   if(get_msg_field()) {
      pri_year = year = atoi(msg_field);
      if((pri_year < ROLLOVER_YEAR) || (pri_year > (ROLLOVER_YEAR+50)));  // piss3 bogus year, use sys clock
      else have_nmea_date |= 0x04;
   }

   check_nmea_date();

   if(get_msg_field()) {  // time zone hours
      tz_hours = atoi(msg_field);
      if(get_msg_field()) {  // time zone minutes
         tz_minutes = atoi(msg_field);
         if((tz_hours < 0) && (tz_minutes > 0)) tz_minutes = 0 - tz_minutes;
      }
      // !!!!!! we should adjust receiver time for time zone if not UTC
      tz_adjust = jtime(tz_hours,tz_minutes,0,0.0);
      if(tz_adjust) {
         jd = jdate(pri_year,pri_month,pri_day) + jtime(pri_hours,pri_minutes,pri_seconds,pri_frac);   
         jd -= tz_adjust;

         set_gregorian_time(jd);
      }
   }

   drive_nmea_screen(system, NMEA_ZDA);
}

// Assembly:
leaq 0x18c04d(%rip), %rax    # 0x2028d0
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, (%rax)
je 0x76a3e
leaq 0xe43d3(%rip), %rax     # 0x15ac70
testl %edi, (%rax)
je 0x769b3
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq 0x18e82b(%rip), %rax    # 0x2050e0
movl %edi, (%rax)
andl $0x0, 0x2e5566(%rip)    # 0x35be24
callq 0x75eb3
callq 0x75767
testl %eax, %eax
je 0x768fc
leaq 0x2af16d(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x280bf5(%rip), %rcx    # 0x2f74d4
movl %eax, (%rcx)
leaq 0x280c24(%rip), %rcx    # 0x2f750c
movl %eax, (%rcx)
addl $-0x20, %eax
cmpl $-0x1f, %eax
jb 0x768fc
leaq 0x18e7ef(%rip), %rax    # 0x2050e8
orb $0x1, (%rax)
callq 0x75767
testl %eax, %eax
je 0x76935
leaq 0x2af134(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x280bc0(%rip), %rcx    # 0x2f74d8
movl %eax, (%rcx)
leaq 0x280bef(%rip), %rcx    # 0x2f7510
movl %eax, (%rcx)
addl $-0xd, %eax
cmpl $-0xc, %eax
jb 0x76935
leaq 0x18e7b6(%rip), %rax    # 0x2050e8
orb $0x2, (%rax)
callq 0x75767
testl %eax, %eax
je 0x76970
leaq 0x2af0fb(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x280b8b(%rip), %rcx    # 0x2f74dc
movl %eax, (%rcx)
leaq 0x280bba(%rip), %rcx    # 0x2f7514
movl %eax, (%rcx)
addl $0xfffff7eb, %eax       # imm = 0xFFFFF7EB
cmpl $-0x33, %eax
jb 0x76970
leaq 0x18e77b(%rip), %rax    # 0x2050e8
orb $0x4, (%rax)
callq 0x760b7
callq 0x75767
testl %eax, %eax
je 0x76a33
leaq 0x2af0b7(%rip), %rdi    # 0x325a40
callq 0x95e0
movl %eax, %ebx
callq 0x75767
testl %eax, %eax
je 0x769b4
leaq 0x2af0a0(%rip), %rdi    # 0x325a40
callq 0x95e0
movl %eax, %esi
negl %esi
cmovnsl %eax, %esi
testl %ebx, %ebx
cmovnsl %eax, %esi
jmp 0x769b6
retq
xorl %esi, %esi
xorpd %xmm0, %xmm0
movl %ebx, %edi
xorl %edx, %edx
callq 0xc2faf
ucomisd 0x7c74d(%rip), %xmm0    # 0xf3118
jne 0x769cf
jnp 0x76a33
leaq 0x280b3e(%rip), %rax    # 0x2f7514
movl (%rax), %edi
leaq 0x280b31(%rip), %rax    # 0x2f7510
movl (%rax), %esi
leaq 0x280b24(%rip), %rax    # 0x2f750c
movl (%rax), %edx
movsd %xmm0, -0x18(%rbp)
callq 0xc2f07
movsd %xmm0, -0x10(%rbp)
leaq 0x280b08(%rip), %rax    # 0x2f7508
movl (%rax), %edi
leaq 0x280afb(%rip), %rax    # 0x2f7504
movl (%rax), %esi
leaq 0x280aee(%rip), %rax    # 0x2f7500
movl (%rax), %edx
leaq 0x280afd(%rip), %rax    # 0x2f7518
movsd (%rax), %xmm0
callq 0xc2faf
addsd -0x10(%rbp), %xmm0
subsd -0x18(%rbp), %xmm0
callq 0x55392
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x7650a