Codebench, Inc.

Voice 561.883.3218

Contact Codebench

Currently Viewing: Home > Tips and Tweaks

2007 Time Zone Rule Changes - Using Expanded Format to Avoid Upgrading the O/S

3/12/2007 Note:  The operating systems did exactly what they were expected to do by applying soley the TZ change as described below. We learned from GE that on PP 4.0 systems, if you have scheduled categories, that any events that were scheduled to fire during the first week following the time change would need to "fixed" using the following script.
LOG="/cas/log/fix_tc.log"
ID=-1
COUNT=1
echo "Starting tc update" > $LOG
selectit "select id from temp_category" > tc.out

while read tc_id
do
        echo "Udating temp_category $tc_id" >> $LOG 2>&1
        sqlstmt "insert into micro_update values (${ID}, 58, ${tc_id}, 2, 75, 2, '1', CURRENT)" >> $LOG 2>&1
        ID=$(expr $ID \- 1)
        if [ $COUNT -eq 5 ]
        then
                COUNT=1
                sleep 1
        else
                COUNT=$(expr $COUNT \+ 1)
        fi
done < tc.out
rm tc.out

There are also some issues related to Java on PP 4.0 systems. This paper does not attempt to address them.

After some research, it appears that we might not need to install any IBM APARs or upgrade GLIBC on Redhat 7.3 systems (at least not due to the time zone change). We can change the 7-character TZ variable to the POSIX expanded format in /etc/environment or /etc/profile. After making the change, you will need to reboot the sysetm. The following TZ settings will work for 99% of the PP systems based in the U.S.:
TZ=EST5EDT4,M3.2.0/01:00:00,M11.1.0/02:00:00 or
TZ=CST6CDT5,M3.2.0/01:00:00,M11.1.0/02:00:00 or
TZ=MST7MDT6,M3.2.0/01:00:00,M11.1.0/02:00:00 or
TZ-PST8PDT7,M3.2.0/01:00:00,M11.1.0/02:00:00
   
It appears all PP systems from 1.5.2 to 4.0 can be configured to automatically transition to/from daylight savings time using this method. We developed a test program tested all PP versions from 1.5.2 through PP 4.0 SP1 and found that the underlying bos.rte.libc and glibc libraries for PP 1.5.2 through 4.0 will all correctly interpret this TZ and will adjust the time accordingly.

For instance, C programs that use localtime() and ftime() to format dates correctly return the time after the time change. What this really means is that because Picture Perfect software is linked with bos.rte.libc on AIX and glibc on Linux, it should compute dates and times the same way as the test program demonstrates.

We are donating the test program to the PPUG forum so that interested parties (GE included) can verify that these system(s) do not necessarily need to be updated. The program does not change the system time nor does it affect any running processes, even when you run it as "root". In the following example, I modified the original to perform a system call to launch TPS in order to demonstrate that the micros are synched automatically. That modification is not included in the donated code but you can easily insert a couple of lines of code to do it like so:
+210  while (!intr) {
+211
+212    toggle *= -1;
+213
+214    chgtime = toggleTZ (toggle, wtime, std, atoi (stdoff), dst, atoi (dstoff), signs);
+215  #if 1
+216    if (geteuid () == 0)
+217      system ("cd /cas/log; tps");
+218  #endif
+219
+220      for (i = 0; i < wtime * 4 && !intr; i++) {
+221  #if 1
+222        if (geteuid () == 0)
+223          if (i == 5) system ("setdiag +snddrv");
+224  #endif
+225
+226            now    = time ((time_t *) NULL);
+227            tmp    = localtime (&now);
+228
+229            YYYY   = tmp->tm_year + 1900;
   
Do so at your own risk!
root@aixdev51# ./tz
Your TZ variable is currently set to EST5EDT4,M3.2.0/01:00:00,M11.1.0/02:00:00
You are currently in EST (standard) time.  Next transition will be to EDT (daylight savings) time.
Setting TZ to TZ=EST+5EDT+4,M2.3.0/05:33:14,M2.3.1/05:33:14 - switch to EDT should occur in 20 seconds
2007/02/18 05:32:54 EST (t-minus 20 seconds)
2007/02/18 05:32:55 EST (t-minus 19 seconds)
2007/02/18 05:32:56 EST (t-minus 18 seconds)
2007/02/18 05:32:57 EST (t-minus 17 seconds)
2007/02/18 05:32:58 EST (t-minus 16 seconds)
2007/02/18 05:32:59 EST (t-minus 15 seconds)
2007/02/18 05:33:00 EST (t-minus 14 seconds)
2007/02/18 05:33:01 EST (t-minus 13 seconds)
2007/02/18 05:33:02 EST (t-minus 12 seconds)
2007/02/18 05:33:03 EST (t-minus 11 seconds)
2007/02/18 05:33:04 EST (t-minus 10 seconds)
2007/02/18 05:33:05 EST (t-minus 9 seconds)
2007/02/18 05:33:06 EST (t-minus 8 seconds)
2007/02/18 05:33:07 EST (t-minus 7 seconds)
2007/02/18 05:33:08 EST (t-minus 6 seconds)
2007/02/18 05:33:09 EST (t-minus 5 seconds)
2007/02/18 05:33:10 EST (t-minus 4 seconds)
2007/02/18 05:33:11 EST (t-minus 3 seconds)
2007/02/18 05:33:12 EST (t-minus 2 seconds)
2007/02/18 05:33:13 EST (t-minus 1 seconds)
2007/02/18 06:33:14 EDT (t-plus 0 seconds)
2007/02/18 06:33:15 EDT (t-plus 1 seconds)
2007/02/18 06:33:16 EDT (t-plus 2 seconds)
2007/02/18 06:33:17 EDT (t-plus 3 seconds)
2007/02/18 06:33:18 EDT (t-plus 4 seconds)
2007/02/18 06:33:19 EDT (t-plus 5 seconds)
2007/02/18 06:33:20 EDT (t-plus 6 seconds)
2007/02/18 06:33:21 EDT (t-plus 7 seconds)
2007/02/18 06:33:22 EDT (t-plus 8 seconds)
2007/02/18 06:33:23 EDT (t-plus 9 seconds)
2007/02/18 06:33:24 EDT (t-plus 10 seconds)
2007/02/18 06:33:25 EDT (t-plus 11 seconds)
2007/02/18 06:33:26 EDT (t-plus 12 seconds)
2007/02/18 06:33:27 EDT (t-plus 13 seconds)
2007/02/18 06:33:28 EDT (t-plus 14 seconds)
2007/02/18 06:33:29 EDT (t-plus 15 seconds)
2007/02/18 06:33:30 EDT (t-plus 16 seconds)
2007/02/18 06:33:31 EDT (t-plus 17 seconds)
2007/02/18 06:33:32 EDT (t-plus 18 seconds)
2007/02/18 06:33:33 EDT (t-plus 19 seconds)
2007/02/18 06:33:34 EDT (t-plus 20 seconds)
2007/02/18 06:33:35 EDT (t-plus 21 seconds)
2007/02/18 06:33:36 EDT (t-plus 22 seconds)
2007/02/18 06:33:37 EDT (t-plus 23 seconds)
2007/02/18 06:33:38 EDT (t-plus 24 seconds)
2007/02/18 06:33:39 EDT (t-plus 25 seconds)
2007/02/18 06:33:40 EDT (t-plus 26 seconds)
   
Since we modified the test program to launch TPS after starting, we can observe what happens to the micro communications across the transition. The log:
05:33:06.250 snddrv: I - FUP 0001, port 1, micro 0
05:33:06.250 snddrv: I - 16 01 00 00 01 FF FF 24 01 00 19 00 04 58
05:33:06.250 snddrv: I - .. 16 19 00 00 01 00 01 00 E4 4D 17
05:33:06.319 snddrv: I - CST 0005, port 1, micro 0
05:33:06.319 snddrv: I - 16 01 00 00 01 FF FF 14 05 00 12 00 04 45
05:33:06.319 snddrv: I - .. 00 00 00 17
05:33:06.378 snddrv: I - ENQ 0008, port 1, micro 0
05:33:06.378 snddrv: I - 16 01 00 00 01 FF FF 3D 08 00 12 00 00 6D
05:33:06.378 snddrv: I - .. 00 00 00 17
05:33:06.431 snddrv: I - ACK BEE6, port 1, micro 0
05:33:06.431 snddrv: I - 16 01 00 00 01 FF FF 06 E6 BE 0F 00 00 CF 17
05:33:06.431 rcvmgr: I - micro 0 placed in true online mode
05:33:06.516 snddrv: I - SYN 0009, port 1, micro 0
05:33:06.516 snddrv: I - 16 01 00 00 01 FF FF 3E 09 00 1A 00 00 77
05:33:06.516 snddrv: I - .. 4A 3F 32 01 3A D0 00 00 00 B1 D2 17
05:33:06.594 snddrv: I - ACK BEE7, port 1, micro 0
05:33:06.594 snddrv: I - 16 01 00 00 01 FF FF 06 E7 BE 0F 00 00 D0 17
05:33:06.651 snddrv: I - ENQ 000E, port 1, micro 0
05:33:06.651 snddrv: I - 16 01 00 00 01 FF FF 3D 0E 00 12 00 00 73
05:33:06.652 snddrv: I - .. 00 00 00 17
05:33:06.799 snddrv: I - ACK BEE8, port 1, micro 0
05:33:06.799 snddrv: I - 16 01 00 00 01 FF FF 06 E8 BE 0F 00 00 D1 17
06:33:23.254 rsndmg: I - FUP 0004, port 0, micro 20
06:33:23.254 rsndmg: I - 16 01 14 00 01 FF FF 24 04 00 19 00 04 6F
06:33:23.254 rsndmg: I - .. 16 19 00 00 01 00 01 00 E4 4D 17
06:33:23.254 rsndmg: E - micro 20 not ACKing message
06:33:23.254 rsndmg: E - flagging sequence 0004 for removal
06:33:23.254 rsndmg: I - setting micro 20 to NULL mode
06:33:23.263 rsndmg: E - micro 20 is not responding
06:33:23.263 rsndmg: I - forced micro 20 into true online mode
06:33:24.024 maa   : I - pid 18080 is alive
06:33:24.046 maa   : I - pid 17836 is alive
06:33:24.058 maa   : I - pid 14266 is alive
06:33:24.077 maa   : I - pid 33008 is alive
06:33:31.988 snddrv: I - ACK BEE9, port 1, micro 0
06:33:31.988 snddrv: I - 16 01 00 00 01 FF FF 06 E9 BE 0F 00 00 D2 17
06:34:00.412 schmgr: I - daylight savings time started; updating micro clocks
06:34:01.271 snddrv: I - SYN 0011, port 1, micro 0
06:34:01.271 snddrv: I - 16 01 00 00 01 FF FF 3E 11 00 1A 00 00 7F
06:34:01.271 snddrv: I - .. 4A 3F 32 01 A9 F7 00 00 00 1F E9 17
06:34:01.272 snddrv: I - SYN 0012, port 2, micro 10
06:34:01.272 snddrv: I - 16 01 0A 00 01 FF FF 3E 12 00 1A 00 00 8A
06:34:01.272 snddrv: I - .. 4A 3F 32 01 A9 F7 00 00 00 1F E9 17
06:34:12.044 snddrv: I - ACK BEEA, port 1, micro 0
06:34:12.044 snddrv: I - 16 01 00 00 01 FF FF 06 EA BE 0F 00 00 D3 17
   
To prove that the micro gets the new time, use bc to check. Find the body of a SYN message and count in 8 bytes. Create a HEX number by working backwards to create a 32-bit unsigned long integer (yes, the Motorola 68K micro talks little endian -- don't ask). In the example below, we dissect one of the log entries: 06:34:01.272 snddrv: I - .. 4A 3F 32 01 A9 F7 00 00 00 1F E9 17
# bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
ibase=16
0000F7A9 
63401