<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Time Pitfalls on Alexander Kurilo</title>
		<link>https://kurilo.me/en/tech/time_pitfalls/</link>
		<description>Recent content in Time Pitfalls on Alexander Kurilo</description>
		<generator>Hugo</generator>
		<language>en-US</language>
		
		
		
			<copyright>© Alexander Kurilo. Opinions are my own. All the texts are licensed under CC BY-SA 4.0 unless otherwise noted.</copyright>
		
		
			<lastBuildDate>Sat, 30 Sep 2017 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://kurilo.me/en/tech/time_pitfalls/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Demo: how TIMESTAMP breaks time in MySQL</title>
				<link>https://kurilo.me/en/tech/time_pitfalls/demo/</link>
				<pubDate>Sat, 30 Sep 2017 00:00:00 +0000</pubDate>
				<guid>https://kurilo.me/en/tech/time_pitfalls/demo/</guid>
				<description>&lt;p&gt;This walkthrough puts the problem described in &lt;a href=&#34;https://kurilo.me/en/tech/time_pitfalls/&#34;&gt;the article&lt;/a&gt; into practice.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-exercise&#34;&gt;The exercise&lt;/h2&gt;&#xA;&lt;p&gt;You need Docker and Bash. If you cannot run the experiment, you can see the result in &lt;a href=&#34;http://sqlfiddle.com/#!9/492da6/2&#34;&gt;SQL Fiddle&lt;/a&gt;. That version changes &lt;code&gt;session.time_zone&lt;/code&gt; instead of the system time zone, but demonstrates the same issue.&lt;/p&gt;&#xA;&lt;p&gt;Start MySQL, then wait for it to accept connections:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker run --name time_test -e MYSQL_ROOT_PASSWORD&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;helloworld -d mysql:5.7 &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker exec -i -e MYSQL_PWD&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;helloworld time_test bash &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;while ! mysql -u root -e exit 2&amp;gt;/dev/null; do sleep 1; echo -n .; done; echo &amp;#34; MySQL seems to be ready&amp;#34;&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make sure the container uses UTC:&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
