-
Senior Member
registered user
I like to keep my system clock and my hardware clock set to local time.
After fiddling with ntpdate and trying to understand all of the intricate and confusing linux time settings, I took total control of the situation with the following script that I run at each bootup and via a cron job every day at 6:30 am.
#!/bin/bash
#To get a list of server names and ip addresses, go to
# http://www.nist.gov/pml/div688/grp40/its.cfm
#Get the time from an internet time server
hhmmss=$(rdate -p -4 -u time-a.nist.gov | tr -s " " | cut -d' ' -f4)
#hhmmss is now a time field of the form hh:mm:ss in utc format
utchour=$(echo $hhmmss | cut -d':' -f1)
minute=$(echo $hhmmss | cut -d':' -f2)
second=$(echo $hhmmss | cut -d':' -f3)
#for my timezone, my offset from utc is 5 hours
OFFSET=5
#To convert the hours to local time
hour=$(( $(($utchour+24-$OFFSET)) % 24 ))
thetime="$hour:$minute:$second"
echo $thetime
#set the system time to thetime
sudo date -s $thetime
#set the hardware clock to the system time
sudo hwclock --systohc
date > /home/knoppix/date.log
Similar Threads
-
By Kirk-out in forum Hardware & Booting
Replies: 2
Last Post: 08-06-2008, 07:25 PM
-
By Crimpshrine in forum MS Windows & New to Linux
Replies: 13
Last Post: 08-23-2006, 12:28 PM
-
By slvrldy17 in forum MS Windows & New to Linux
Replies: 2
Last Post: 02-23-2006, 04:06 AM
-
By maxmartin in forum Customising & Remastering
Replies: 4
Last Post: 02-19-2006, 06:09 PM
-
By Lion in forum Hdd Install / Debian / Apt
Replies: 2
Last Post: 05-13-2005, 10:45 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

Vintage Mainframe Computer Disk Drive Pack Dyson SMD 5 Level Disks
$79.00

Vintage Intel Mainframe Server MCM CPU Substrate Lot Prototyping PGA Validation
$500.00

HP 5060-8359 8K Semiconductor Memory Module 5080-9747 Vintage HP Computer
$165.58

HP 13210-60001 Disc Drive Interface PCB HP 7900A 7901A Vintage
$166.24

Vtg IBM Mainframe Prototype Chip Module Lot 146 pc 1988-1993 ES/9000 Lab Arcive
$649.00

Commodore 64 PC with Model 1541 Diskette Drive and Flight Simulator II *READ*
$199.99

Mainframe Computer Data Punch Card Lot of 50 Orange 80 Column IBM comp Vtg NOS
$15.00

Rare Vintage Mainframe Burroughs Discrete-Transistor Cordwood Module B2500/B5000
$99.95

Vintage Telex 952003-112 Mechanical Terminal Keyboard IBM 3270 Mainframe DB25
$799.00

Vintage UNIVAC 3620670-01 Mainframe Logic Board 15MHz Sperry Computer PCB
$98.95