[ LUGOS ] Y2K Bug
Metod Kozelj
metod.kozelj na rzs-hm.si
Pon Jan 17 09:43:01 CET 2000
--Boundary (ID J1ZRpaUV2nzuD48O0mEJHQ)
Content-id: <Pine.HPP.3.96.1000117094155.26578D na hmljhp.rzs-hm.si>
Content-type: TEXT/PLAIN; CHARSET=ISO-8859-2
Content-transfer-encoding: 8BIT
Howdy!
> Imam eno staro ma^Úino 486 , katera nikakor noče obdr^Ţati letnice 2000,
> vedno jo spremeni v 2096. Zanima me če obstaja kak^Úen programček, ki bi
> ob zagonu spremenil letnico v 2000.
Uporabi program date.
Ampak pozor: uro moras nastaviti v dveh korakih, pa se to bo slo le v
okviru natancnosti kaksne sekunde.
Recimo, ce hoces nastaviti uro na 17. januar 2000 ob 9:24:33, potem gre
takole:
date -s 2000-01-17
date -s 09:24:33
Ce ti tvoja masina zabluzi le z letom, dan, mesec, uro, minuto in
sekundo pa ti nastavi pravilno, potem lahko naredis eno avtomatiko, ki ti
popravi le leto (kot primer glej skripto v prilogi).
Peace!
Mkx
---- perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
--Boundary (ID J1ZRpaUV2nzuD48O0mEJHQ)
Content-id: <Pine.HPP.3.96.1000117094151.26578A na hmljhp.rzs-hm.si>
Content-type: TEXT/PLAIN; NAME=rc.clock; CHARSET=US-ASCII
Content-description:
#!/bin/sh
#
# Set date to current epoch.
#
# If linux is booted from SRM console, it might get year wrong. Offset is
# +48 and this should be corrected before everything else works.
#
# month, day, hour, minute and second are set correct. Therefore we should
# get the date from SRM, set it back by 48 years, if it seems to be
# necessary, and set the date. Then we rely on NTP or some other mechanism
# to get date and time precise.
#
####
#
YEAR=`date -u +%Y`
#
# Check, if we have to fiddle with date. If the year is way too big, we
# have to do it.
#
# date only supports to set time to one minute precission. We don't want to
# sleep for whole minute (in worst case) to get it precise. Therefore time
# must be corrected using NTP or something.
#
if [ ${YEAR} -gt 2037 ]; then
YEAR=$(( ${YEAR} - 48 ))
MONTH=`date -u +%m`
DAY=`date -u +%d`
HOUR=`date -u +%H`
MINUTE=`date -u +%M`
DATUM=${YEAR}${MONTH}${DAY}
TIME=${HOUR}${MINUTE}
date -u -s ${DATUM}
date -u -s ${TIME}
fi
--Boundary (ID J1ZRpaUV2nzuD48O0mEJHQ)--
Dodatne informacije o seznamu Starilist