[mythtv-users] UTC -> Local?

j2 at mupp.net j2 at mupp.net
Sat Feb 9 16:07:25 UTC 2008


   So, I finally got a working Wake-via-ACPI routine going, but there  
is one thing that i can't quite figure out: How to convert a UTC-time  
-> Local. Becuase as it is now, the system displays the wakeup  
time at UTC in the display when it shuts down. I would prefer to have it  
in local time.

Any hints?


#!/bin/bash
#
# MythWakeSet
#
# set mythtv wake-up time with UTC-adjusted time
#

# temp file for working with time
temp_stamp=/tmp/timestamp

tmp=`echo $2 | awk -F: '{print strftime("%Y-%m-%dT%T", $1)}'`
tmp1=`echo $tmp | awk 'BEGIN { FS = "T" } { print $1 }'`
tmp2=`echo $tmp | awk 'BEGIN { FS = "T" } { print $2 }'`
echo $tmp1\ $tmp2 > $temp_stamp


# Read the date in *locale* time format and tag the time-zone info to  
the wake time
localeadd=$(/bin/date -f $temp_stamp +%F\ %T\ %z)
echo $localeadd > $temp_stamp

# adjust this to UTC and store the final wake time
utcadj=$(/bin/date -u -f $temp_stamp +%F\ %T)


# set the alarm
echo $utcadj > /proc/acpi/alarm

# update LCDd so it displays the wakeup time when the box shuts down.

cat /home/j2/LCDd.conf.template | sed -e "s/XXWAKETIMEXX/$utcadj/g" >  
/etc/LCDd.conf

#Restart LCDd so the new values for GOODBYE is read.
sudo /etc/init.d/LCDd restart

#
#kill monit so it does not try to restart mythbackend
#if it should happen to run while we are shutting down.
sudo /usr/sbin/monit quit





More information about the mythtv-users mailing list