LinHES Forums http://forum.linhes.org/ |
|
Problem with date command http://forum.linhes.org/viewtopic.php?f=5&t=13111 |
Page 1 of 1 |
Author: | turpie [ Wed Dec 27, 2006 5:02 am ] |
Post subject: | Problem with date command |
I am trying to setup the automatic wakeup stuff but am having some trouble getting the times correct. The date -u command gives me the time offset by five hours forward instead of 11 back. If I'm only after the current time it works fine: Code: root@mythtv:/home/mythtv# date +%T\ %z 21:59:40 +1100 root@mythtv:/home/mythtv# date +%T\ %z -u 10:59:50 +0000 But if I'm trying to specify a time it is offset by the wrong amount: Code: root@mythtv:/home/mythtv# date -d "01:23 EST" +%T\ %z
01:23:00 +1100 root@mythtv:/home/mythtv# date -d "01:23 EST" -u +%T\ %z 06:23:00 +0000 Any ideas? |
Author: | khrusher [ Wed Dec 27, 2006 7:56 am ] |
Post subject: | |
hmm, seems to be working for me... It is almost 9:00 AM here in EST Code: root@mythtv:~# date +"%T %z" 08:52:35 -0500 If I want the time of 12:01 PM in PST (displayed in my timezone) it correctly shows 3:01 PM Code: date -d "12:01 PST" +"%T %z" 15:01:00 -0500 which is 8:01 PM in greenwich Code: date -d "12:01 PST" +"%T %z" -u
20:01:00 +0000 What exactly are you trying to do? |
Author: | turpie [ Wed Dec 27, 2006 9:02 pm ] |
Post subject: | |
khrusher wrote: What exactly are you trying to do?
I'm trying to get ACPI Wakeups working. I can get the machine to wake up automatically but because the hardware clock runs in UTC time I need to convert from the local time before setting the wakeup alarm. If I try to get it to wake up at 06:00 it will instead wake up at 17:00. |
Author: | tjc [ Wed Dec 27, 2006 9:13 pm ] |
Post subject: | |
Code: root@black2:~# date
Wed Dec 27 22:12:43 EST 2006 root@black2:~# TZ=GMT date Thu Dec 28 03:12:44 GMT 2006 |
Author: | turpie [ Wed Dec 27, 2006 9:42 pm ] |
Post subject: | |
After seeing that you guys are both in MA in the USA I've realised that EST is an ambiguous abbreviation. See here http://www.timeanddate.com/library/abbr ... timezones/ The bash script in the mythtv wiki ACPI Wakeup article used the following line. Code: datum=$(/bin/date -f $stamp_file +%F\ %T\ %Z) I have changed the %Z to %z and it now gives the correct time. Code: datum=$(/bin/date -f $stamp_file +%F\ %T\ %z)
I will update the wiki soon. |
Author: | richwine4 [ Sun Feb 25, 2007 11:36 am ] |
Post subject: | |
I'm sure this has an obvious answer, but where do we 'put' that script that corrects for the timezone difference? When should it get called? |
Author: | turpie [ Sun Feb 25, 2007 5:35 pm ] |
Post subject: | |
richwine4 wrote: I'm sure this has an obvious answer, but where do we 'put' that script that corrects for the timezone difference? When should it get called?
Are you trying to use ACPI wakeups? I ended up using tohc1's script instead which I also had to modify slightly. http://mysettopbox.tv/phpBB2/viewtopic. ... highlight= He puts the script in /usr/bin/setwakeup.sh but I on my system I put it in /home/mythtv/setwakeup.sh because files in the mythtv home directory will be backed up and kept when I autoupgrade to the next version of Knoppmyth. Upgrading will only keep certain directories and the rest is wiped. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |