// File: /workspace/github_cpp_makefile_star2_O3/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 0x196614(%rip), %rax    # 0x2188d0
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, (%rax)
je 0x8247a
leaq 0xee99a(%rip), %rax     # 0x170c70
testl %edi, (%rax)
je 0x823ef
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq 0x198df2(%rip), %rax    # 0x21b0e0
movl %edi, (%rax)
movl $0x0, 0x2efb2a(%rip)    # 0x371e24
callq 0x81835
callq 0x810b1
testl %eax, %eax
je 0x82338
leaq 0x2b9731(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28b1b9(%rip), %rcx    # 0x30d4d4
movl %eax, (%rcx)
leaq 0x28b1e8(%rip), %rcx    # 0x30d50c
movl %eax, (%rcx)
addl $-0x20, %eax
cmpl $-0x1f, %eax
jb 0x82338
leaq 0x198db3(%rip), %rax    # 0x21b0e8
orb $0x1, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x82371
leaq 0x2b96f8(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28b184(%rip), %rcx    # 0x30d4d8
movl %eax, (%rcx)
leaq 0x28b1b3(%rip), %rcx    # 0x30d510
movl %eax, (%rcx)
addl $-0xd, %eax
cmpl $-0xc, %eax
jb 0x82371
leaq 0x198d7a(%rip), %rax    # 0x21b0e8
orb $0x2, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x823ac
leaq 0x2b96bf(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28b14f(%rip), %rcx    # 0x30d4dc
movl %eax, (%rcx)
leaq 0x28b17e(%rip), %rcx    # 0x30d514
movl %eax, (%rcx)
addl $0xfffff7eb, %eax       # imm = 0xFFFFF7EB
cmpl $-0x33, %eax
jb 0x823ac
leaq 0x198d3f(%rip), %rax    # 0x21b0e8
orb $0x4, (%rax)
callq 0x81ad5
callq 0x810b1
testl %eax, %eax
je 0x8246f
leaq 0x2b967b(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %ebx
callq 0x810b1
testl %eax, %eax
je 0x823f0
leaq 0x2b9664(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %esi
negl %esi
cmovnsl %eax, %esi
testl %ebx, %ebx
cmovnsl %eax, %esi
jmp 0x823f2
retq
xorl %esi, %esi
xorpd %xmm0, %xmm0
movl %ebx, %edi
xorl %edx, %edx
callq 0xd492e
ucomisd 0x86d11(%rip), %xmm0    # 0x109118
jne 0x8240b
jnp 0x8246f
leaq 0x28b102(%rip), %rax    # 0x30d514
movl (%rax), %edi
leaq 0x28b0f5(%rip), %rax    # 0x30d510
movl (%rax), %esi
leaq 0x28b0e8(%rip), %rax    # 0x30d50c
movl (%rax), %edx
movsd %xmm0, -0x18(%rbp)
callq 0xd485e
movsd %xmm0, -0x10(%rbp)
leaq 0x28b0cc(%rip), %rax    # 0x30d508
movl (%rax), %edi
leaq 0x28b0bf(%rip), %rax    # 0x30d504
movl (%rax), %esi
leaq 0x28b0b2(%rip), %rax    # 0x30d500
movl (%rax), %edx
leaq 0x28b0c1(%rip), %rax    # 0x30d518
movsd (%rax), %xmm0
callq 0xd492e
addsd -0x10(%rbp), %xmm0
subsd -0x18(%rbp), %xmm0
callq 0x5c71d
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x81f3d