Time setting does not work in 1.07

Please post any bugs you have found
Post Reply
Message
Author
User avatar
Raman
Posts: 86
Joined: Fri 02 Sep 2005, 03:25
Location: A Place Where Cows Are Sacred

Time setting does not work in 1.07

#1 Post by Raman »

The "set time" function within the date/time desktop setting does not work in Puppy 1.07. The "set time" function simply returns the current time without being reset.

Hail Puppy!

Raman

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

The program is a very small shellscript, that uses "hwclock".
/usr/sbin/set-time-for-puppy

It seems there is a new version of hwclock in puppy.
It does not recognize --set , what can be replaced with -s
But I don't know how you could replace --date= ,that also is not supported in this version.

Anybody knows a solution?
Mark

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#3 Post by GuestToo »

my set-time-from-the-internet program sets the system clock (using rdate) then sets the hardware clock from the system time
hwclock --systohc --localtime (assuming you are using localtime, not UTC)
Last edited by GuestToo on Sun 01 Jan 2006, 04:39, edited 1 time in total.

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#4 Post by GuestToo »

sorry, hit quote instead of edit

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#5 Post by MU »

thanks, will have a look tomorrow, too unconcentrated atm.
Mark

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#6 Post by MU »

/usr/sbin/set-time-for-puppy

Version for Puppy 107 (should work on older puppys, too)

Code: Select all

#!/bin/sh

# A small script used to set the time under Linux with hwclock...

# Title to be used for all Xdialog boxes.
TITLE="Set time tool"

# Now check for hwclock existence...
if ! [ -f /usr/sbin/hwclock ] ; then
	Xdialog --title "$TITLE" --msgbox "/usr/sbin/hwclock not found..." 0 0
	exit 0
fi

# Get the date (returned in DD/MM/YYYY format by Xdialog.
ENTEREDDATE=`Xdialog --stdout --title "$TITLE" --calendar "Please set the date..." 0 0 0 0 0`
if [ ! $? -eq 0 ]; then
	exit
fi

# Convert the date to the MM/DD/YYYY format needed by hwclock.
NEWDATE=`echo "$ENTEREDDATE" | awk --source 'BEGIN { FS="/" }' --source '{ print $2 "/" $1 "/" $3 }'`

# Get the time in HH:MM:SS format.
NEWTIME=`Xdialog --stdout --title "$TITLE" --timebox "Please set the time..." 0 0`
if [ ! $? -eq 0 ]; then
	Xdialog --title "$TITLE" --msgbox "Aborted." 0 0
	exit
fi


# Set the hardware clock (RTC) and then the system clock

D=`echo $NEWDATE|sed "s/^...//" | sed "s/\/.*$//"`

M=`echo $NEWDATE|sed "s/\/.*$//"`
Y=`echo $NEWDATE|sed "s/^........//" | sed "s/ .*$//"`

H=`echo $NEWTIME|sed "s/^.* //" | sed "s/://g" | sed "s/..$//"`

DT=`echo $M$D$H$Y`

date $DT


Xdialog --title "info" --msgbox "Your screen might turn black now for some seconds, just wait..." 0 0

/usr/sbin/hwclock --systohc --localtime

THEDATE=`date`
Xdialog --title "info" --msgbox "Finished. Time was set to $THEDATE" 0 0


User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#7 Post by BarryK »

Guys, I went over to Busybox hwclock, as it is in the new busybox 1.01. I didn't realise that would break anything -- but, I could go back to the "full" hwclock if you would prefer.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#8 Post by MU »

no, just update the script with the code from my last posting.
G2 already added it to the service pack 107.
mark

User avatar
jmarsden
Posts: 265
Joined: Sat 31 Dec 2005, 22:18
Location: California, USA

Making hwclock --utc or --localtime configurable

#9 Post by jmarsden »

One further issue with time configuration in 1.0.7 is that there does not seem to be a way to set whether or not the hardware clock is using UTC or local time. The code just assumes it uses local time.

That is how Windows boxes work, but not how Linux machines are generally set up.

For now I just edited line 48 of /etc/rc.d/local0 -- but I think it would be more general if the config utility allowed the user to set a checkbox for "RTC uses UTC" or something like that, and the script(s) made use of that to use either --localtime or --utc when calling hwclock.

Is this worth pursuing?

Jonathan

Post Reply