<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: cannot set TZ for 2301 when time is 0001 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922996#M97254</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Fiddling with the TZ variable to increment or decrement a time is doomed to failure.&lt;BR /&gt;&lt;BR /&gt;Instead, use Perl to obtain the previous hour and minute:&lt;BR /&gt;&lt;BR /&gt;# perl -e '($min,$sec)=(localtime(time()-60*60))[2,1];printf "%02d%02d\n",$min,$sec'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Tue, 09 Jan 2007 08:40:37 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2007-01-09T08:40:37Z</dc:date>
    <item>
      <title>cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922995#M97253</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I run a script that ftp's a file that was created with the previous hours time stamp by altering $TZ within the script:&lt;BR /&gt;&lt;BR /&gt;cd $OUTDIR&lt;BR /&gt;OTZ=`echo $TZ`&lt;BR /&gt;TZ="GMT1BST"&lt;BR /&gt;FHOUR=`date +%H`&lt;BR /&gt;TFILE=`ls ${NFILE}_${DATE}_${FHOUR}*.csv`&lt;BR /&gt;TZ="$OTZ"&lt;BR /&gt;&lt;BR /&gt;                if [ -f ${OUTDIR}/${TFILE} ] ; then&lt;BR /&gt;&lt;BR /&gt;                        continue&lt;BR /&gt;&lt;BR /&gt;                else&lt;BR /&gt;&lt;BR /&gt;                        logfile "$TFILE is not available for transfer, please investigate and transfer the file."&lt;BR /&gt;                        exit 1&lt;BR /&gt;                fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;        echo "put $TFILE" &amp;gt;&amp;gt; $FTP&lt;BR /&gt;        echo "$DATE:$TIME//Transfering $TFILE to $SERV " &amp;gt;&amp;gt; $PROGLOG&lt;BR /&gt;        echo "!EOF" &amp;gt;&amp;gt; $FTP &lt;BR /&gt;        chmod 777 $FTP&lt;BR /&gt;&lt;BR /&gt;$FTP&lt;BR /&gt;&lt;BR /&gt;        if [ $? -ne 0 ] ; then&lt;BR /&gt;&lt;BR /&gt;                logfile "failed to FTP $TFILE to $SERV" &lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;The problem I have is at 00:01 when the script is excecuted it doesn't pick up the file for 2301 ....&lt;BR /&gt;&lt;BR /&gt;any idea's please?&lt;BR /&gt;&lt;BR /&gt;many thanks&lt;BR /&gt;&lt;BR /&gt;Chris.&lt;BR /&gt;&lt;BR /&gt;filename:&lt;BR /&gt;&lt;BR /&gt;retail_20070109_2301.csv</description>
      <pubDate>Tue, 09 Jan 2007 08:10:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922995#M97253</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2007-01-09T08:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922996#M97254</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Fiddling with the TZ variable to increment or decrement a time is doomed to failure.&lt;BR /&gt;&lt;BR /&gt;Instead, use Perl to obtain the previous hour and minute:&lt;BR /&gt;&lt;BR /&gt;# perl -e '($min,$sec)=(localtime(time()-60*60))[2,1];printf "%02d%02d\n",$min,$sec'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 09 Jan 2007 08:40:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922996#M97254</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-01-09T08:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922997#M97255</link>
      <description>love the termanology James ....&lt;BR /&gt;&lt;BR /&gt;Ok thanks that's great however is there an awk alternative?&lt;BR /&gt;&lt;BR /&gt;Many thanks.&lt;BR /&gt;&lt;BR /&gt;Chris!</description>
      <pubDate>Tue, 09 Jan 2007 08:43:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922997#M97255</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2007-01-09T08:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922998#M97256</link>
      <description>Hi (again) Lawrenzo:&lt;BR /&gt;&lt;BR /&gt;If you were to use the GNU 'awk' ('gawk') then you have some intrinsic timestamp functions available to you:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.gnu.org/software/gawk/manual/gawk.html" target="_blank"&gt;http://www.gnu.org/software/gawk/manual/gawk.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;See section 8.1.5 in the above link.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 09 Jan 2007 08:49:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922998#M97256</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-01-09T08:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922999#M97257</link>
      <description>I am still having an issue here because the file date I am trying to pick up is failing at 00:01.&lt;BR /&gt;&lt;BR /&gt;I can manipulate the hour to go back to 2301 however I am having trouble getting the date to go back ....&lt;BR /&gt;&lt;BR /&gt;how can I use perl to set the variable FDATE to display the previous day when the script is run at 0001?&lt;BR /&gt;&lt;BR /&gt;Unfortunatly gawk is not installed across all our systems so that is not an option.&lt;BR /&gt;&lt;BR /&gt;Thanks for any help.&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Thu, 18 Jan 2007 06:50:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3922999#M97257</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2007-01-18T06:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923000#M97258</link>
      <description>I can manipulate the date in the following method:&lt;BR /&gt;&lt;BR /&gt;OTZ=`echo $TZ`&lt;BR /&gt;TZ="GMT1BST"&lt;BR /&gt;FHOUR=`date +%H`&lt;BR /&gt;FDATE=`date +%Y%m%d`&lt;BR /&gt;TFILE=`ls ${NFILE}_${FDATE}_${FHOUR}*.csv`&lt;BR /&gt;TZ="$OTZ"&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Thu, 18 Jan 2007 07:10:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923000#M97258</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2007-01-18T07:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923001#M97259</link>
      <description>Hi,&lt;BR /&gt;please study/adapt:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;date&lt;BR /&gt;rm -f /tmp/x; touch /tmp/x &lt;BR /&gt;ar -r foo /tmp/x &lt;BR /&gt;timer=`tail -1 foo | awk -F' ' '{print $2}'`&lt;BR /&gt;echo $timer&lt;BR /&gt;echo "0d$timer=Y" | adb | tr -d '\011' &lt;BR /&gt;# Take off 1 day 3600 sec * 24&lt;BR /&gt;timer=`expr $timer - 86400`&lt;BR /&gt;echo $timer&lt;BR /&gt;echo "0d$timer=Y" | adb | tr -d '\011' &lt;BR /&gt;&lt;BR /&gt;This is based on the epoche (secs since 1/1/1970). Output is:&lt;BR /&gt;$ ./b.sh&lt;BR /&gt;Thu Jan 18 12:27:59 GMT 2007&lt;BR /&gt;1169123279&lt;BR /&gt;2007 Jan 18 12:27:59&lt;BR /&gt;1169036879&lt;BR /&gt;2007 Jan 17 12:27:59&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Jan 2007 07:31:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923001#M97259</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-01-18T07:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923002#M97260</link>
      <description>ok thanks Peter I will give this a go.</description>
      <pubDate>Thu, 18 Jan 2007 07:51:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923002#M97260</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2007-01-18T07:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923003#M97261</link>
      <description>Hi (again) Lawrenzo:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I can manipulate the hour to go back to 2301 however I am having trouble getting the date to go back ....how can I use perl to set the variable FDATE to display the previous day when the script is run at 0001?&lt;BR /&gt;&lt;BR /&gt;We can add the year, month and day to our output quite easily and then you can snip the date and time components from it.&lt;BR /&gt;&lt;BR /&gt;# perl -le '($year,$mon,$day,$hrs,$min)=(localtime(time()-$ARGV[0]))[5,4,3,2,1];printf "%04d%02d%02d:%02d%02d\n",$year+1900,$mon+1,$day,$hrs,$min' 3600&lt;BR /&gt;&lt;BR /&gt;...will return the yyyymmdd:hhmm 3600-seconds (one hour) ago.  You can pass any number of seconds earlier as the argument you need.  For exactly 24-hours ago, the argument would be 86400 (of course).&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 18 Jan 2007 11:01:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923003#M97261</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-01-18T11:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: cannot set TZ for 2301 when time is 0001</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923004#M97262</link>
      <description>ok thanks James,&lt;BR /&gt;&lt;BR /&gt;Actually I have had a play with epoch time today and have learned something new.&lt;BR /&gt;&lt;BR /&gt;I will study the world of perl next time I get a bit of time.&lt;BR /&gt;&lt;BR /&gt;for now I will use your solution as I can uderstand what the command is doing and will be able to trouble shoot better.&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Thu, 18 Jan 2007 11:16:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cannot-set-tz-for-2301-when-time-is-0001/m-p/3923004#M97262</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2007-01-18T11:16:14Z</dc:date>
    </item>
  </channel>
</rss>

