<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cat brain.log &#124; less &#187; timezone</title>
	<atom:link href="http://log.largevoid.com/tag/timezone/feed/" rel="self" type="application/rss+xml" />
	<link>http://log.largevoid.com</link>
	<description>Getting it down on `paper`</description>
	<lastBuildDate>Mon, 06 Feb 2012 06:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP 5.1+ Date vs Strftime Timezone Annoyance</title>
		<link>http://log.largevoid.com/2010/02/php-date-strftime-timezone-annoyance/</link>
		<comments>http://log.largevoid.com/2010/02/php-date-strftime-timezone-annoyance/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 02:10:45 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[putenv]]></category>
		<category><![CDATA[reverse compatable]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=302</guid>
		<description><![CDATA[In the old PHP4 days, you could change the default timezone by: putenv("TZ=America/Los_Angeles");. In php5, you can still do this and it&#8217;ll work for strtotime, strftime, gmstftime (maybe more). It will not work for methods date and gmdate. For those, starting in version 5.1, you&#8217;ll need to call date_default_timezone_set("America/Los_Angeles");. This is just another one of [...]]]></description>
			<content:encoded><![CDATA[<p>In the old PHP4 days, you could change the default timezone by: <code>putenv("TZ=America/Los_Angeles");</code>.  In php5, you can still do this and it&#8217;ll work for strtotime, strftime, gmstftime (maybe more).  It will not work for methods date and gmdate.  For those, starting in version 5.1, you&#8217;ll need to call <code>date_default_timezone_set("America/Los_Angeles");</code>.  This is just another one of those annoying things that make PHP a dying language.</p>
<p>Together, to be cross-version compliant:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">putenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;TZ=America/Los_Angeles&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;date_default_timezone_set&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
 <span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;America/Los_Angeles&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We need both to be reverse-compatible with PHP4.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/02/php-date-strftime-timezone-annoyance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server Patches and Time Zones</title>
		<link>http://log.largevoid.com/2009/07/server-patches-and-time-zones/</link>
		<comments>http://log.largevoid.com/2009/07/server-patches-and-time-zones/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 02:00:05 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[hwclock]]></category>
		<category><![CDATA[sbin]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[sysconfig]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=7</guid>
		<description><![CDATA[Sometimes, after a server patch, the timezone is reset to Pacific time.  Why?  I don’t know, but when you patch a machine, be sure to double-check that the time zone after the patch is the same as before the patch.  If not, set it. Logged in, then su, check which timezone your machine is currently [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, after a server patch, the timezone is reset to Pacific time.  Why?  I don’t know, but when you patch a machine, be sure to double-check that the time zone after the patch is the same as before the patch.  If not, set it.</p>
<ol>
<li>Logged in, then <code>su</code>, check which timezone your machine is currently using by executing `<strong>date</strong>`. You’ll see something like <code>Mon 17 Jan 2005 12:15:08 PM PST</code>, PST in this case is the current timezone.</li>
<li>Change to the directory <code>/usr/share/zoneinfo</code> here you will find a list of time zone regions. Choose the most appropriate region, if you live in Canada or the US this directory is the “America” directory.</li>
<li>If you wish, backup the previous timezone configuration by copying it to a different location. Such as<br />
<code>mv /etc/localtime  /etc/localtime-old</code></li>
<li>Create a symbolic link from the appropriate timezone to /etc/localtime. Example:<br />
<code>ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime</code></li>
<li>If you have the utility rdate, update the current system time by executing<br />
<code>/usr/bin/rdate -s time-a.nist.gov</code></li>
<li>Set the ZONE entry in the file <code>/etc/sysconfig/clock</code> file (e.g. “America/Los_Angeles”)</li>
<li>Set the hardware clock by executing:<br />
<code>/sbin/hwclock --systohc</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2009/07/server-patches-and-time-zones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  log.largevoid.com/tag/timezone/feed/ ) in 0.39433 seconds, on Feb 8th, 2012 at 12:28 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 8th, 2012 at 1:28 pm UTC -->
