// File: /workspace/github_cpp_makefile_star2_O1/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 0x196516(%rip), %rax    # 0x2188d0
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, (%rax)
je 0x82578
leaq 0xee89c(%rip), %rax     # 0x170c70
testl %edi, (%rax)
je 0x824ed
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq 0x198cf4(%rip), %rax    # 0x21b0e0
movl %edi, (%rax)
movl $0x0, 0x2efa2c(%rip)    # 0x371e24
callq 0x8191e
callq 0x811da
testl %eax, %eax
je 0x82436
leaq 0x2b9633(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28b0bb(%rip), %rcx    # 0x30d4d4
movl %eax, (%rcx)
leaq 0x28b0ea(%rip), %rcx    # 0x30d50c
movl %eax, (%rcx)
addl $-0x20, %eax
cmpl $-0x1f, %eax
jb 0x82436
leaq 0x198cb5(%rip), %rax    # 0x21b0e8
orb $0x1, (%rax)
callq 0x811da
testl %eax, %eax
je 0x8246f
leaq 0x2b95fa(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28b086(%rip), %rcx    # 0x30d4d8
movl %eax, (%rcx)
leaq 0x28b0b5(%rip), %rcx    # 0x30d510
movl %eax, (%rcx)
addl $-0xd, %eax
cmpl $-0xc, %eax
jb 0x8246f
leaq 0x198c7c(%rip), %rax    # 0x21b0e8
orb $0x2, (%rax)
callq 0x811da
testl %eax, %eax
je 0x824aa
leaq 0x2b95c1(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28b051(%rip), %rcx    # 0x30d4dc
movl %eax, (%rcx)
leaq 0x28b080(%rip), %rcx    # 0x30d514
movl %eax, (%rcx)
addl $0xfffff7eb, %eax       # imm = 0xFFFFF7EB
cmpl $-0x33, %eax
jb 0x824aa
leaq 0x198c41(%rip), %rax    # 0x21b0e8
orb $0x4, (%rax)
callq 0x81bb6
callq 0x811da
testl %eax, %eax
je 0x8256d
leaq 0x2b957d(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %ebx
callq 0x811da
testl %eax, %eax
je 0x824ee
leaq 0x2b9566(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %esi
negl %esi
cmovnsl %eax, %esi
testl %ebx, %ebx
cmovnsl %eax, %esi
jmp 0x824f0
retq
xorl %esi, %esi
xorpd %xmm0, %xmm0
movl %ebx, %edi
xorl %edx, %edx
callq 0xd41e0
ucomisd 0x86c13(%rip), %xmm0    # 0x109118
jne 0x82509
jnp 0x8256d
leaq 0x28b004(%rip), %rax    # 0x30d514
movl (%rax), %edi
leaq 0x28aff7(%rip), %rax    # 0x30d510
movl (%rax), %esi
leaq 0x28afea(%rip), %rax    # 0x30d50c
movl (%rax), %edx
movsd %xmm0, -0x18(%rbp)
callq 0xd4110
movsd %xmm0, -0x10(%rbp)
leaq 0x28afce(%rip), %rax    # 0x30d508
movl (%rax), %edi
leaq 0x28afc1(%rip), %rax    # 0x30d504
movl (%rax), %esi
leaq 0x28afb4(%rip), %rax    # 0x30d500
movl (%rax), %edx
leaq 0x28afc3(%rip), %rax    # 0x30d518
movsd (%rax), %xmm0
callq 0xd41e0
addsd -0x10(%rbp), %xmm0
subsd -0x18(%rbp), %xmm0
callq 0x5c837
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x8201e