// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: set_time_zone(char*)
void set_time_zone(char *s)
{
char c;

   time_zone_set = 0;

   use_loran = use_gps = use_utc = 0;
   use_gmst = use_lmst = 0;
   use_tai = use_tt = use_ut1 = use_tcg = use_tdb = use_tcb = use_hjd = use_bessel = 0;
   use_msd = use_ven = use_merc = use_pluto = 0;

   tz_string[0] = dst_string[0] = 0;
   if(s == 0) return;

   if((s[0] == 0) || (s[0] == 0x0A) || (s[0] == 0x0D)) {  // clear time zone
      return;
   }

   if(s[0] == ':') return;  // Linux :... time zone string

   // set time zone
   strcpy(std_string, "LOCAL");
   dst_string[0] = 0;
   strcpy(tz_string, dst_string);

   time_zone_set = 1;
   tz_sign = 1;
   time_zone_hours = 0;
   time_zone_minutes = 0;
   time_zone_seconds = 0;
   tz_adjust = 0.0;

   while(*s) {  // find first char of time zone string
      c = *s;
      if(c == 0)    { break; }
      if(c == '>')  { break; }
      if(c == '<')  { ++s; continue; }
      if(c == ' ')  { ++s; continue; }
      if(c == '\t') { ++s; continue; }
      if(c == '=')  { ++s; continue; }

      if((c == '+') || (c == '-') || isdigit(c)) {  // tz string is -6CST/CDT format
         s = get_tz_value(s);
         if(s) s = get_std_zone(s, 0);
         if(s) {
            if(*s == '/') get_dst_zone(s+1);
         }
      }
      else {   // string is in CST6CDT format
         s = get_std_zone(s, 1);
         if(s) {
            tz_sign = (-1);
            s = get_tz_value(s);
         }
         if(s) get_dst_zone(s);
      }
      break;
   }

   if     (!strcmp(std_string, "SST"))   solar_time = 1;
   else if(!strcmp(dst_string, "SDT"))   solar_time = 1;
   else if(!strcmp(std_string, "SOL"))   solar_time = 1;
   else if(!strcmp(dst_string, "SOL"))   solar_time = 1;
   else if(!strcmp(std_string, "SOLAR")) solar_time = 1;
   else if(!strcmp(dst_string, "SOLAR")) solar_time = 1;
   else                                  solar_time = 0;

   if(user_set_watch_name == 0) {
      if(solar_time) {
         set_watch_name("Solar");
         label_watch_face = 1;
      }
      else {
         watch_name[0] = 0;
         label_watch_face = 1;
      }
   }

   if     (!strcmp(std_string, "LMST"))  use_lmst = 1;   // sidereal times
   else if(!strcmp(std_string, "LAST"))  use_lmst = 2;
   else if(!strcmp(std_string, "GMST"))  use_gmst = 1;
   else if(!strcmp(std_string, "GAST"))  use_gmst = 2;

   else if(!strcmp(std_string, "TAI"))   use_tai = 1;    // astronomical times
   else if(!strcmp(std_string, "TCG"))   use_tcg = 1;
   else if(!strcmp(std_string, "TCB"))   use_tcb = 1;
   else if(!strcmp(std_string, "TDB"))   use_tdb = 1;
   else if(!strcmp(std_string, "TDT"))   use_tt = 1;
   else if(!strcmp(std_string, "TT"))    use_tt = 1;
   else if(!strcmp(std_string, "UT"))    use_ut1 = 1;
   else if(!strcmp(std_string, "UT1"))   use_ut1 = 1;
   else if(!strcmp(std_string, "HJD"))   use_hjd = 1;
   else if(!strcmp(std_string, "BES"))   use_bessel= 1;

   else if(!strcmp(std_string, "UTC"))   use_utc = 1;    // various nav system times
   else if(!strcmp(std_string, "GPS"))   use_gps = 1;
   else if(!strcmp(std_string, "GPST"))  use_gps = 1;
   else if(!strcmp(std_string, "LOR"))   use_loran = 1;
   else if(!strcmp(std_string, "LORAN")) use_loran = 1;

   else if(!strcmp(std_string, "MAR"))   use_msd = 1;    // various names of Mars time
   else if(!strcmp(std_string, "MARS"))  use_msd = 1;  
   else if(!strcmp(std_string, "MARSD")) use_msd = 1;  
   else if(!strcmp(std_string, "MSD"))   use_msd = 1;  
   else if(!strcmp(std_string, "MTC"))   use_msd = 1;  
   else if(!strcmp(std_string, "AMT"))   use_msd = 1;  

   else if(!strcmp(std_string, "MER"))   use_merc = 1;   // planetary times
   else if(!strcmp(std_string, "PLU"))   use_pluto = 1;
   else if(!strcmp(std_string, "VEN"))   use_ven = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x235bd1(%rip), %rax    # 0x36ca74
movb $0x0, (%rax)
leaq 0x235c3e(%rip), %rax    # 0x36caeb
movb $0x0, (%rax)
leaq 0x235c33(%rip), %rax    # 0x36caea
movb $0x0, (%rax)
leaq 0x235c28(%rip), %rax    # 0x36cae9
movb $0x0, (%rax)
leaq 0x235c16(%rip), %rax    # 0x36cae1
movb $0x0, (%rax)
leaq 0x235c0b(%rip), %rax    # 0x36cae0
movb $0x0, (%rax)
leaq 0x235c11(%rip), %rax    # 0x36caf0
movb $0x0, (%rax)
leaq 0x235bff(%rip), %rax    # 0x36cae8
movb $0x0, (%rax)
leaq 0x235bf4(%rip), %rax    # 0x36cae7
movb $0x0, (%rax)
leaq 0x235be9(%rip), %rax    # 0x36cae6
movb $0x0, (%rax)
leaq 0x235bde(%rip), %rax    # 0x36cae5
movb $0x0, (%rax)
leaq 0x235bd1(%rip), %rax    # 0x36cae2
movb $0x0, (%rax)
leaq 0x235bc9(%rip), %rax    # 0x36cae4
movb $0x0, (%rax)
leaq 0x235bbe(%rip), %rax    # 0x36cae3
movb $0x0, (%rax)
leaq 0x235bc0(%rip), %rax    # 0x36caef
movb $0x0, (%rax)
leaq 0x235bb4(%rip), %rax    # 0x36caed
movb $0x0, (%rax)
leaq 0x235bab(%rip), %rax    # 0x36caee
movb $0x0, (%rax)
leaq 0x235b9f(%rip), %rax    # 0x36caec
movb $0x0, (%rax)
leaq 0x235baf(%rip), %rax    # 0x36cb06
movb $0x0, (%rax)
leaq 0x235bab(%rip), %rax    # 0x36cb0c
movb $0x0, (%rax)
cmpq $0x0, -0x8(%rbp)
jne 0x136f70
jmp 0x13770c
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x136f94
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
je 0x136f94
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x136f99
jmp 0x13770c
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x136faa
jmp 0x13770c
leaq 0x235b4f(%rip), %rdi    # 0x36cb00
leaq 0x5f7bf(%rip), %rsi     # 0x196777
callq 0x9350
leaq 0x235b42(%rip), %rax    # 0x36cb06
movb $0x0, (%rax)
leaq 0x235b3e(%rip), %rdi    # 0x36cb0c
leaq 0x235b31(%rip), %rsi    # 0x36cb06
callq 0x9350
leaq 0x235a93(%rip), %rax    # 0x36ca74
movb $0x1, (%rax)
leaq 0x235a8d(%rip), %rax    # 0x36ca78
movl $0x1, (%rax)
leaq 0x235a70(%rip), %rax    # 0x36ca68
movl $0x0, (%rax)
leaq 0x235a67(%rip), %rax    # 0x36ca6c
movl $0x0, (%rax)
leaq 0x235a5e(%rip), %rax    # 0x36ca70
movl $0x0, (%rax)
leaq 0x235a41(%rip), %rax    # 0x36ca60
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x8(%rbp), %rax
cmpb $0x0, (%rax)
je 0x137165
movq -0x8(%rbp), %rax
movb (%rax), %al
movb %al, -0x9(%rbp)
movsbl -0x9(%rbp), %eax
cmpl $0x0, %eax
jne 0x13704a
jmp 0x137165
movsbl -0x9(%rbp), %eax
cmpl $0x3e, %eax
jne 0x137058
jmp 0x137165
movsbl -0x9(%rbp), %eax
cmpl $0x3c, %eax
jne 0x13706f
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x137026
movsbl -0x9(%rbp), %eax
cmpl $0x20, %eax
jne 0x137086
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x137026
movsbl -0x9(%rbp), %eax
cmpl $0x9, %eax
jne 0x13709d
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x137026
movsbl -0x9(%rbp), %eax
cmpl $0x3d, %eax
jne 0x1370b7
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x137026
movsbl -0x9(%rbp), %eax
cmpl $0x2b, %eax
je 0x1370d7
movsbl -0x9(%rbp), %eax
cmpl $0x2d, %eax
je 0x1370d7
movsbl -0x9(%rbp), %edi
callq 0x9330
cmpl $0x0, %eax
je 0x13711e
movq -0x8(%rbp), %rdi
callq 0x136910
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1370fa
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x136b60
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x13711c
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x13711a
movq -0x8(%rbp), %rdi
addq $0x1, %rdi
callq 0x136ce0
jmp 0x13711c
jmp 0x137163
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x136b60
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x137151
leaq 0x23593a(%rip), %rax    # 0x36ca78
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
callq 0x136910
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x137161
movq -0x8(%rbp), %rdi
callq 0x136ce0
jmp 0x137163
jmp 0x137165
leaq 0x235994(%rip), %rdi    # 0x36cb00
leaq 0x5f60a(%rip), %rsi     # 0x19677d
callq 0x9510
cmpl $0x0, %eax
jne 0x13718c
leaq 0x23596d(%rip), %rax    # 0x36caf1
movb $0x1, (%rax)
jmp 0x137257
leaq 0x235973(%rip), %rdi    # 0x36cb06
leaq 0x5f5e7(%rip), %rsi     # 0x196781
callq 0x9510
cmpl $0x0, %eax
jne 0x1371b3
leaq 0x235946(%rip), %rax    # 0x36caf1
movb $0x1, (%rax)
jmp 0x137255
leaq 0x235946(%rip), %rdi    # 0x36cb00
leaq 0x50875(%rip), %rsi     # 0x187a36
callq 0x9510
cmpl $0x0, %eax
jne 0x1371d7
leaq 0x23591f(%rip), %rax    # 0x36caf1
movb $0x1, (%rax)
jmp 0x137253
leaq 0x235928(%rip), %rdi    # 0x36cb06
leaq 0x50851(%rip), %rsi     # 0x187a36
callq 0x9510
cmpl $0x0, %eax
jne 0x1371fb
leaq 0x2358fb(%rip), %rax    # 0x36caf1
movb $0x1, (%rax)
jmp 0x137251
leaq 0x2358fe(%rip), %rdi    # 0x36cb00
leaq 0x4b8ce(%rip), %rsi     # 0x182ad7
callq 0x9510
cmpl $0x0, %eax
jne 0x13721f
leaq 0x2358d7(%rip), %rax    # 0x36caf1
movb $0x1, (%rax)
jmp 0x13724f
leaq 0x2358e0(%rip), %rdi    # 0x36cb06
leaq 0x4b8aa(%rip), %rsi     # 0x182ad7
callq 0x9510
cmpl $0x0, %eax
jne 0x137243
leaq 0x2358b3(%rip), %rax    # 0x36caf1
movb $0x1, (%rax)
jmp 0x13724d
leaq 0x2358a7(%rip), %rax    # 0x36caf1
movb $0x0, (%rax)
jmp 0x13724f
jmp 0x137251
jmp 0x137253
jmp 0x137255
jmp 0x137257
leaq 0x2666b2(%rip), %rax    # 0x39d910
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x1372a0
leaq 0x235884(%rip), %rax    # 0x36caf1
cmpb $0x0, (%rax)
je 0x13728a
leaq 0x4b864(%rip), %rdi     # 0x182add
callq 0x63930
leaq 0x26668a(%rip), %rax    # 0x39d90f
movb $0x1, (%rax)
jmp 0x13729e
leaq 0x26663f(%rip), %rax    # 0x39d8d0
movb $0x0, (%rax)
leaq 0x266674(%rip), %rax    # 0x39d90f
movb $0x1, (%rax)
jmp 0x1372a0
leaq 0x235859(%rip), %rdi    # 0x36cb00
leaq 0x5f4d7(%rip), %rsi     # 0x196785
callq 0x9510
cmpl $0x0, %eax
jne 0x1372c7
leaq 0x235822(%rip), %rax    # 0x36cae1
movb $0x1, (%rax)
jmp 0x13770c
leaq 0x235832(%rip), %rdi    # 0x36cb00
leaq 0x5f4b5(%rip), %rsi     # 0x19678a
callq 0x9510
cmpl $0x0, %eax
jne 0x1372ee
leaq 0x2357fb(%rip), %rax    # 0x36cae1
movb $0x2, (%rax)
jmp 0x13770a
leaq 0x23580b(%rip), %rdi    # 0x36cb00
leaq 0x5f493(%rip), %rsi     # 0x19678f
callq 0x9510
cmpl $0x0, %eax
jne 0x137315
leaq 0x2357d3(%rip), %rax    # 0x36cae0
movb $0x1, (%rax)
jmp 0x137708
leaq 0x2357e4(%rip), %rdi    # 0x36cb00
leaq 0x5f471(%rip), %rsi     # 0x196794
callq 0x9510
cmpl $0x0, %eax
jne 0x13733c
leaq 0x2357ac(%rip), %rax    # 0x36cae0
movb $0x2, (%rax)
jmp 0x137706
leaq 0x2357bd(%rip), %rdi    # 0x36cb00
leaq 0x5f44f(%rip), %rsi     # 0x196799
callq 0x9510
cmpl $0x0, %eax
jne 0x137363
leaq 0x235788(%rip), %rax    # 0x36cae3
movb $0x1, (%rax)
jmp 0x137704
leaq 0x235796(%rip), %rdi    # 0x36cb00
leaq 0x5f42c(%rip), %rsi     # 0x19679d
callq 0x9510
cmpl $0x0, %eax
jne 0x13738a
leaq 0x235763(%rip), %rax    # 0x36cae5
movb $0x1, (%rax)
jmp 0x137702
leaq 0x23576f(%rip), %rdi    # 0x36cb00
leaq 0x5f409(%rip), %rsi     # 0x1967a1
callq 0x9510
cmpl $0x0, %eax
jne 0x1373b1
leaq 0x23573e(%rip), %rax    # 0x36cae7
movb $0x1, (%rax)
jmp 0x137700
leaq 0x235748(%rip), %rdi    # 0x36cb00
leaq 0x5f3e6(%rip), %rsi     # 0x1967a5
callq 0x9510
cmpl $0x0, %eax
jne 0x1373d8
leaq 0x235716(%rip), %rax    # 0x36cae6
movb $0x1, (%rax)
jmp 0x1376fe
leaq 0x235721(%rip), %rdi    # 0x36cb00
leaq 0x5f3c3(%rip), %rsi     # 0x1967a9
callq 0x9510
cmpl $0x0, %eax
jne 0x1373ff
leaq 0x2356ed(%rip), %rax    # 0x36cae4
movb $0x1, (%rax)
jmp 0x1376fc
leaq 0x2356fa(%rip), %rdi    # 0x36cb00
leaq 0x51838(%rip), %rsi     # 0x188c45
callq 0x9510
cmpl $0x0, %eax
jne 0x137426
leaq 0x2356c6(%rip), %rax    # 0x36cae4
movb $0x1, (%rax)
jmp 0x1376fa
leaq 0x2356d3(%rip), %rdi    # 0x36cb00
leaq 0x52383(%rip), %rsi     # 0x1897b7
callq 0x9510
cmpl $0x0, %eax
jne 0x13744d
leaq 0x23569d(%rip), %rax    # 0x36cae2
movb $0x1, (%rax)
jmp 0x1376f8
leaq 0x2356ac(%rip), %rdi    # 0x36cb00
leaq 0x5f352(%rip), %rsi     # 0x1967ad
callq 0x9510
cmpl $0x0, %eax
jne 0x137474
leaq 0x235676(%rip), %rax    # 0x36cae2
movb $0x1, (%rax)
jmp 0x1376f6
leaq 0x235685(%rip), %rdi    # 0x36cb00
leaq 0x5f32f(%rip), %rsi     # 0x1967b1
callq 0x9510
cmpl $0x0, %eax
jne 0x13749b
leaq 0x235655(%rip), %rax    # 0x36cae8
movb $0x1, (%rax)
jmp 0x1376f4
leaq 0x23565e(%rip), %rdi    # 0x36cb00
leaq 0x5f30c(%rip), %rsi     # 0x1967b5
callq 0x9510
cmpl $0x0, %eax
jne 0x1374c2
leaq 0x235636(%rip), %rax    # 0x36caf0
movb $0x1, (%rax)
jmp 0x1376f2
leaq 0x235637(%rip), %rdi    # 0x36cb00
leaq 0x60570(%rip), %rsi     # 0x197a40
callq 0x9510
cmpl $0x0, %eax
jne 0x1374e9
leaq 0x23560a(%rip), %rax    # 0x36caeb
movb $0x1, (%rax)
jmp 0x1376f0
leaq 0x235610(%rip), %rdi    # 0x36cb00
leaq 0x5ef62(%rip), %rsi     # 0x196459
callq 0x9510
cmpl $0x0, %eax
jne 0x137510
leaq 0x2355e2(%rip), %rax    # 0x36caea
movb $0x1, (%rax)
jmp 0x1376ee
leaq 0x2355e9(%rip), %rdi    # 0x36cb00
leaq 0x5f29b(%rip), %rsi     # 0x1967b9
callq 0x9510
cmpl $0x0, %eax
jne 0x137537
leaq 0x2355bb(%rip), %rax    # 0x36caea
movb $0x1, (%rax)
jmp 0x1376ec
leaq 0x2355c2(%rip), %rdi    # 0x36cb00
leaq 0x5f279(%rip), %rsi     # 0x1967be
callq 0x9510
cmpl $0x0, %eax
jne 0x13755e
leaq 0x235593(%rip), %rax    # 0x36cae9
movb $0x1, (%rax)
jmp 0x1376ea
leaq 0x23559b(%rip), %rdi    # 0x36cb00
leaq 0x5f256(%rip), %rsi     # 0x1967c2
callq 0x9510
cmpl $0x0, %eax
jne 0x137585
leaq 0x23556c(%rip), %rax    # 0x36cae9
movb $0x1, (%rax)
jmp 0x1376e8
leaq 0x235574(%rip), %rdi    # 0x36cb00
leaq 0x5f235(%rip), %rsi     # 0x1967c8
callq 0x9510
cmpl $0x0, %eax
jne 0x1375ac
leaq 0x235548(%rip), %rax    # 0x36caec
movb $0x1, (%rax)
jmp 0x1376e6
leaq 0x23554d(%rip), %rdi    # 0x36cb00
leaq 0x5f212(%rip), %rsi     # 0x1967cc
callq 0x9510
cmpl $0x0, %eax
jne 0x1375d3
leaq 0x235521(%rip), %rax    # 0x36caec
movb $0x1, (%rax)
jmp 0x1376e4
leaq 0x235526(%rip), %rdi    # 0x36cb00
leaq 0x5f1f0(%rip), %rsi     # 0x1967d1
callq 0x9510
cmpl $0x0, %eax
jne 0x1375fa
leaq 0x2354fa(%rip), %rax    # 0x36caec
movb $0x1, (%rax)
jmp 0x1376e2
leaq 0x2354ff(%rip), %rdi    # 0x36cb00
leaq 0x5f1cf(%rip), %rsi     # 0x1967d7
callq 0x9510
cmpl $0x0, %eax
jne 0x137621
leaq 0x2354d3(%rip), %rax    # 0x36caec
movb $0x1, (%rax)
jmp 0x1376e0
leaq 0x2354d8(%rip), %rdi    # 0x36cb00
leaq 0x5f1ac(%rip), %rsi     # 0x1967db
callq 0x9510
cmpl $0x0, %eax
jne 0x137648
leaq 0x2354ac(%rip), %rax    # 0x36caec
movb $0x1, (%rax)
jmp 0x1376de
leaq 0x2354b1(%rip), %rdi    # 0x36cb00
leaq 0x5f189(%rip), %rsi     # 0x1967df
callq 0x9510
cmpl $0x0, %eax
jne 0x13766c
leaq 0x235485(%rip), %rax    # 0x36caec
movb $0x1, (%rax)
jmp 0x1376dc
leaq 0x23548d(%rip), %rdi    # 0x36cb00
leaq 0x5f169(%rip), %rsi     # 0x1967e3
callq 0x9510
cmpl $0x0, %eax
jne 0x137690
leaq 0x235462(%rip), %rax    # 0x36caed
movb $0x1, (%rax)
jmp 0x1376da
leaq 0x235469(%rip), %rdi    # 0x36cb00
leaq 0x5f149(%rip), %rsi     # 0x1967e7
callq 0x9510
cmpl $0x0, %eax
jne 0x1376b4
leaq 0x235440(%rip), %rax    # 0x36caef
movb $0x1, (%rax)
jmp 0x1376d8
leaq 0x235445(%rip), %rdi    # 0x36cb00
leaq 0x5f129(%rip), %rsi     # 0x1967eb
callq 0x9510
cmpl $0x0, %eax
jne 0x1376d6
leaq 0x23541b(%rip), %rax    # 0x36caee
movb $0x1, (%rax)
jmp 0x1376d8
jmp 0x1376da
jmp 0x1376dc
jmp 0x1376de
jmp 0x1376e0
jmp 0x1376e2
jmp 0x1376e4
jmp 0x1376e6
jmp 0x1376e8
jmp 0x1376ea
jmp 0x1376ec
jmp 0x1376ee
jmp 0x1376f0
jmp 0x1376f2
jmp 0x1376f4
jmp 0x1376f6
jmp 0x1376f8
jmp 0x1376fa
jmp 0x1376fc
jmp 0x1376fe
jmp 0x137700
jmp 0x137702
jmp 0x137704
jmp 0x137706
jmp 0x137708
jmp 0x13770a
jmp 0x13770c
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)