LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-22-2007, 02:04 PM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 57
[root] Changing time without using ntp/ntpdate ?


I saw that :
Code:
# hwclock --set --date="05/18/2007 18:00:00"
# hwclock --hctosys
could change the date. But it is not working.
what could be failing point I missed ?

also, at the boot, the debian etch is checking the time from server, that couldnt be changed or set to a ntp , and this without affecting/telling that to the BIOS ?


________

I finally found it works with directiva option.
damn, not so easy

__
http://linux.die.net/man/8/hwclock

Last edited by frenchn00b; 07-22-2007 at 03:15 PM.
 
Old 07-22-2007, 04:53 PM   #2
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
rather solved.
I made a script to configure the time and date, starting at boot in /etc/rc2.d/S21myscripttime

with XXXXXXXXXXXXXXXXX number of my city
Code:
elinks "http://www.timeanddate.com/worldclock/city.html?n=XXXXXXXXXXXXXXXXX"  > timetown.htm

cat timetown.htm   | grep CEST > timetown

pyear="$(    cat   timetown | awk ' NR==1 {   print $5  }  '  |  awk  '{ gsub (",", "") ; print  }  '       )"
pmonth="07"
pday="$(cat   timetown | awk ' NR==1 {   print $4  }  '  |  awk  '{ gsub (",", "") ; print  }  '  )"

ptime="$(   cat   timetown | awk ' NR==1 {   print $7  }  '  |  awk  '{ gsub (",", "") ; print  }  '  )"

pheure="$(echo "$ptime" | awk '  {  n=split($1 , vk , ":")  ;  print vk[1]         }                 ')"
echo $pheure + 12 | bc

echo "the text:--$pyear/$pmonth/$pday $ptime--"

if [  "$(cat   timetown | awk ' NR==1 {   print $8  }  '  |  awk  '{ gsub (",", "") ; print  }  ')"   == "PM" ] ; then
	pheure="$(echo $pheure + 12 | bc )"
	pmin="$(echo "$ptime" | awk '  {  n=split($1 , vk , ":")  ;  print vk[2]         }                 ')"
	psec="$(echo "$ptime" | awk '  {  n=split($1 , vk , ":")  ;  print vk[3]         }                 ')"
	ptime="$pheure:$pmin:$psec"
fi
echo "the text:--$pyear/$pmonth/$pday $ptime--"
valuetime="$pmonth/$pday/$pyear $ptime"
echo "the time is $valuetime"
sudo hwclock --directisa --set --date="$valuetime"
sudo hwclock --directisa --hctosys
echo "$valuetime configured to"
echo "the date:"
date
echo "--"
it works.

So, I have two questions:
Is this script harmful ? Is this script affecting the Bios (it looks that not but i am not sure) ?



---
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NTP time sync with windows 2000 AD time csghosh Linux - Enterprise 7 02-24-2012 04:46 PM
NTPDATE - Time Sync'ing finaidques Linux - General 4 05-02-2007 10:53 AM
Running your own NTP Time Server darkarcon2015 Red Hat 1 05-16-2006 01:06 PM
NTP and Daylight Savings Time jrdioko Linux - Software 8 11-01-2005 10:25 AM
ntp time sync eyewittness Linux - Networking 2 08-11-2004 10:18 AM


All times are GMT -5. The time now is 02:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration