Set Date Under AIX 1.3

Rick Ekblaw wrote:
   You'll find that the DATE command has some problems.  When I did my earlier installs in
 March, it would accept a date change and process it  correctly.  Here in April, the DATE command sets the year to 1902 (you can only specify two digits for the year, but it is *supposed* to understand that 02 means 2002 -- it did in March). 
     The trick is to first issue the command DATE 12312359.5901 to set the clock to 11:59:59PM
 on December 31, 2001.  When the clock rolls over to 2002, you issue the DATE command in the
 format DATE 04242200.00, leaving off the year, and it leaves the year alone.  This "two-step"
 process sets the correct date and time. 
   (Ed. Rick is certainly right on with this- I tried MMddHHmm.ssyy which is supposed to grok the
 02 year, but I got 14 June 1902!) 

Ulrich Link said:
   At boot time the script "/etc/init.dir/B2s.i386" reads the RTC from /dev/clock and want to feed this into the "date" for setting the UNIX clock with "date `cat /dev/clock`". The problem is the format when reading from /dev/clock. According to the manpage "date" all yy are assumed to be 19yy! Another problem is that after setting the date 12262200.5502 the date bootet from reference partition shows the year 2010!

The workaround: cut off the substring yy and append it after the .ss you can do this with "awk", after that you need to put back the right year back to the real time clock.

To do so, simply replace the line in "/etc/init.dir/B2s.i386"

date `cat /dev/clock`

with (or without the comments)

# save the cmos rtc value to variable TMPDATE
TMPDATE=`cat /dev/clock`

# cut off prepending year and append it with awk
date `echo "$TMPDATE" \
| awk '{printf("%s",substr($0,3,11));printf("%s",substr($0,0,2))}'`

# set the correct value back to cmos rtc
# instead of the false value date writes back
echo "$TMPDATE" > /dev/clock

Now I can reboot my Model 9557slc2 without any manual date adjustment.

Content created and/or collected by:
Louis F. Ohland, Peter H. Wendt, David L. Beem, William R. Walsh, Tatsuo Sunagawa, Tomáš Slavotínek, Jim Shorney, Tim N. Clarke, Kevin Bowling, and many others.

Ardent Tool of Capitalism is maintained by Tomáš Slavotínek.
Last update: 08 May 2024 - Changelog | About | Legal & Contact