From owner-freebsd-current Thu Apr 4 09:22:20 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA12004 for current-outgoing; Thu, 4 Apr 1996 09:22:20 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id JAA11996 for ; Thu, 4 Apr 1996 09:22:13 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id DAA22855; Fri, 5 Apr 1996 03:19:56 +1000 Date: Fri, 5 Apr 1996 03:19:56 +1000 From: Bruce Evans Message-Id: <199604041719.DAA22855@godzilla.zeta.org.au> To: freebsd-current@FreeBSD.org, j@uriah.heep.sax.de Subject: Re: adjkerntz (was: cvs commit: src/usr.sbin/tzsetup ...) Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk >(brokeness of adjkerntz for the last DST switchover in the EU) >How to reproduce: setup localtime as MET, and tweak your clock to run >from Mar 31, 1996, 01:58 MET onwards. Watch the syslog at 02:00 MET >(where the switch happened to 03:00 MET DST). I tested this. adjkerntz(8) has problems going from non-DST to DST. date(1) has even more problems with this. The other direction seems to work OK. I tested zones Sydney and Moscow. Your problem is more obvious for MET but easier to debug for Sydney - MET is close to GMT so there are some problem times around 4am when adjkerntz is run by cron. I had to fix `adjkerntz -a' to not wait when there is a problem. Waiting doesn't work for reboot, and it causes too many adjkerntz's when cron starts several waiting ones, and it gets in the way of debugging. --- *** adjkerntz.c~ Wed May 31 19:39:17 1995 --- adjkerntz.c Thu Apr 4 21:46:36 1996 *************** *** 161,166 **** * middle of the nonexistent hour means 3:30 am. */ syslog(LOG_WARNING, ! "Nonexistent local time -- will retry after %d secs", REPORT_PERIOD); (void) signal(SIGTERM, SIG_DFL); (void) sigprocmask(SIG_UNBLOCK, &mask, NULL); --- 161,172 ---- * middle of the nonexistent hour means 3:30 am. */ + if (!init) { + syslog(LOG_WARNING, + "Nonexistent local time -- giving up"); + return 1; + } syslog(LOG_WARNING, ! "Nonexistent local time -- will retry after %d secs", ! REPORT_PERIOD); (void) signal(SIGTERM, SIG_DFL); (void) sigprocmask(SIG_UNBLOCK, &mask, NULL); *************** *** 207,212 **** * but perhaps we never get here. */ syslog(LOG_WARNING, ! "Nonexistent (final) local time -- will retry after %d secs", REPORT_PERIOD); (void) signal(SIGTERM, SIG_DFL); (void) sigprocmask(SIG_UNBLOCK, &mask, NULL); --- 213,224 ---- * but perhaps we never get here. */ + if (!init) { + syslog(LOG_WARNING, + "Nonexistent (final) local time -- giving up"); + return 1; + } syslog(LOG_WARNING, ! "Nonexistent (final) local time -- will retry after %d secs", ! REPORT_PERIOD); (void) signal(SIGTERM, SIG_DFL); (void) sigprocmask(SIG_UNBLOCK, &mask, NULL); --- I used the following test program (warning: it always corrupts the time a little when it terminates and a lot when it is aborted): --- #!/bin/sh date -u +%y%m%d%H%m.%S >/tmp/znow # try(day, time) try() { local day local time day=$1 time=$2 echo $day$time date $day$time; obj/adjkerntz -a sysctl machdep.adjkerntz date obj/adjkerntz -a sysctl machdep.adjkerntz date } # Bugs for Northern Hemisphere in March. export TZ=Europe/Moscow for day in 960331 do # # The 4 hour difference between these groups of times is the initial # # timezone difference for Moscow. for time in 0159 0200 0201 0259 0300 0300 0301 \ 0559 0600 0601 0659 0700 0700 0701 do try $day $time done done # Bugs for Southern Hemisphere in October. export TZ=Australia/Sydney for day in 961027 do # The 11 hour difference between these groups of times is the initial # timezone difference for Sydney. for time in 0159 0200 0201 0259 0300 0300 0301 \ 1259 1300 1301 1359 1400 1400 1401 do try $day $time done done date -u `cat /tmp/znow` --- Running this gave the following output (except for the comment lines begiining with `#'): --- 9603310159 Sun Mar 31 01:59:00 MSK 1996 machdep.adjkerntz: -14400 Sun Mar 31 01:59:00 MSK 1996 machdep.adjkerntz: -14400 Sun Mar 31 01:59:00 MSK 1996 # # OK. # 9603310200 date: illegal time format usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format] [yy[mm[dd[hh]]]]mm[.ss]] machdep.adjkerntz: -14400 Sun Mar 31 01:59:00 MSK 1996 machdep.adjkerntz: -14400 Sun Mar 31 01:59:00 MSK 1996 # # Bug in date(1). date(1) should fail, but the time was nonexistent, not # illegal, and the usage was correct. # 9603310201 date: illegal time format usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format] [yy[mm[dd[hh]]]]mm[.ss]] machdep.adjkerntz: -14400 Sun Mar 31 01:59:01 MSK 1996 machdep.adjkerntz: -14400 Sun Mar 31 01:59:01 MSK 1996 # # Bug in date(1), as above. # 9603310259 date: illegal time format usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format] [yy[mm[dd[hh]]]]mm[.ss]] machdep.adjkerntz: -14400 Sun Mar 31 01:59:01 MSK 1996 machdep.adjkerntz: -14400 Sun Mar 31 01:59:02 MSK 1996 # # Bug in date(1), as above. # 9603310300 Sun Mar 31 04:00:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 04:00:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 04:00:00 MSD 1996 # # A different bug in date(1) or in mktime(3). We set 3am but got 4am. # Also, machdep.adjkerntz should probably have changed. It changes when # we switch DST in the other direction. # 9603310300 Sun Mar 31 03:00:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 03:00:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 03:00:00 MSD 1996 # # OK, except possibly for the value in machdep.adjkerntz. # We set 3am again an got 3am. Since the DST is the same for the initial # and final dates, date(1) and mktime(3) have an easier task. # 9603310301 Sun Mar 31 03:01:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 03:01:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 03:01:00 MSD 1996 # # OK, as above. # 9603310559 Sun Mar 31 05:59:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 05:59:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 05:59:00 MSD 1996 # # OK, as above. # 9603310600 Sun Mar 31 06:00:00 MSD 1996 adjkerntz[7741]: Nonexistent local time -- giving up machdep.adjkerntz: -14400 Sun Mar 31 06:00:00 MSD 1996 adjkerntz[7744]: Nonexistent local time -- giving up machdep.adjkerntz: -14400 Sun Mar 31 06:00:00 MSD 1996 # # Bug in adjkerntz(8). I think it subtracts 4 hours from 6am to get 2am, # which is an invalid time. # 9603310601 Sun Mar 31 06:01:00 MSD 1996 adjkerntz[7748]: Nonexistent local time -- giving up machdep.adjkerntz: -14400 Sun Mar 31 06:01:00 MSD 1996 adjkerntz[7751]: Nonexistent local time -- giving up machdep.adjkerntz: -14400 Sun Mar 31 06:01:00 MSD 1996 # # Bug in adjkerntz(8), as above. # 9603310659 Sun Mar 31 06:59:00 MSD 1996 adjkerntz[7755]: Nonexistent local time -- giving up machdep.adjkerntz: -14400 Sun Mar 31 06:59:00 MSD 1996 adjkerntz[7758]: Nonexistent local time -- giving up machdep.adjkerntz: -14400 Sun Mar 31 06:59:00 MSD 1996 # # Bug in adjkerntz(8), as above. # 9603310700 Sun Mar 31 07:00:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 07:00:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 07:00:00 MSD 1996 # # OK, as above. # 9603310700 Sun Mar 31 07:00:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 07:00:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 07:00:00 MSD 1996 # # OK, as above. # 9603310701 Sun Mar 31 07:01:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 07:01:00 MSD 1996 machdep.adjkerntz: -14400 Sun Mar 31 07:01:00 MSD 1996 # # OK, as above. # 9610270159 Sun Oct 27 01:59:00 EST 1996 machdep.adjkerntz: -36000 Sun Oct 27 01:59:00 EST 1996 machdep.adjkerntz: -36000 Sun Oct 27 01:59:00 EST 1996 # # OK. # 9610270200 date: illegal time format usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format] [yy[mm[dd[hh]]]]mm[.ss]] machdep.adjkerntz: -36000 Sun Oct 27 01:59:00 EST 1996 machdep.adjkerntz: -36000 Sun Oct 27 01:59:00 EST 1996 # # Bug in date(1), as above. # 9610270201 date: illegal time format usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format] [yy[mm[dd[hh]]]]mm[.ss]] machdep.adjkerntz: -36000 Sun Oct 27 01:59:01 EST 1996 machdep.adjkerntz: -36000 Sun Oct 27 01:59:01 EST 1996 # # Bug in date(1), as above. # 9610270259 date: illegal time format usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format] [yy[mm[dd[hh]]]]mm[.ss]] machdep.adjkerntz: -36000 Sun Oct 27 01:59:01 EST 1996 machdep.adjkerntz: -36000 Sun Oct 27 01:59:01 EST 1996 # # Bug in date(1), as above. # 9610270300 Sun Oct 27 04:00:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 04:00:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 04:00:00 EST 1996 # # A different bug in date(1) or in mktime(3), as above. We set 3am but # got 4am. # machdep.adjkerntz got adjusted correctly, NOT as above. # 9610270300 Sun Oct 27 03:00:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 03:00:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 03:00:00 EST 1996 # # OK. Setting 3am worked the second time, as above. # 9610270301 Sun Oct 27 03:01:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 03:01:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 03:01:00 EST 1996 # # OK. # 9610271259 Sun Oct 27 12:59:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 12:59:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 12:59:00 EST 1996 # # OK. # 9610271300 Sun Oct 27 13:00:00 EST 1996 adjkerntz[8043]: Nonexistent local time -- giving up machdep.adjkerntz: -39600 Sun Oct 27 13:00:00 EST 1996 adjkerntz[8046]: Nonexistent local time -- giving up machdep.adjkerntz: -39600 Sun Oct 27 13:00:00 EST 1996 # # Bug in adjkerntz(8). I think it subtracts 11 hours from 1pm to get 2am, # which is an invalid time. # 9610271301 Sun Oct 27 13:01:00 EST 1996 adjkerntz[8050]: Nonexistent local time -- giving up machdep.adjkerntz: -39600 Sun Oct 27 13:01:00 EST 1996 adjkerntz[8053]: Nonexistent local time -- giving up machdep.adjkerntz: -39600 Sun Oct 27 13:01:00 EST 1996 # # Bug in adjkerntz(8), as above. # 9610271359 Sun Oct 27 13:59:00 EST 1996 adjkerntz[8057]: Nonexistent local time -- giving up machdep.adjkerntz: -39600 Sun Oct 27 13:59:00 EST 1996 adjkerntz[8060]: Nonexistent local time -- giving up machdep.adjkerntz: -39600 Sun Oct 27 13:59:00 EST 1996 # # Bug in adjkerntz(8), as above. # 9610271400 Sun Oct 27 14:00:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 14:00:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 14:00:00 EST 1996 # # OK. # 9610271400 Sun Oct 27 14:00:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 14:00:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 14:00:00 EST 1996 # # OK. # 9610271401 Sun Oct 27 14:01:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 14:01:00 EST 1996 machdep.adjkerntz: -39600 Sun Oct 27 14:01:00 EST 1996 Tue Oct 29 15:10:26 GMT 1996 # # OK. # --- Bruce