From c2717b64788fd05098f1d1f5499def9fbc4af957 Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Mon, 18 Aug 2014 17:46:54 +0300
Subject: [PATCH] openelec: setup timezone

---
 xbmc/linux/LinuxTimezone.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/xbmc/linux/LinuxTimezone.cpp b/xbmc/linux/LinuxTimezone.cpp
index b4ffd13..5bf41eb 100644
--- a/xbmc/linux/LinuxTimezone.cpp
+++ b/xbmc/linux/LinuxTimezone.cpp
@@ -39,6 +39,8 @@
 #include "settings/lib/Setting.h"
 #include "settings/Settings.h"
 
+#include <fstream>
+
 using namespace std;
 
 CLinuxTimezone::CLinuxTimezone() : m_IsDST(0)
@@ -158,6 +160,16 @@ void CLinuxTimezone::OnSettingChanged(const CSetting *setting)
   const std::string &settingId = setting->GetId();
   if (settingId == "locale.timezone")
   {
+    std::ofstream out("/storage/.cache/timezone");
+    if (out)
+    {
+      const std::string tz = std::string("TIMEZONE=") + ((CSettingString*)setting)->GetValue().c_str();
+      out << tz << std::endl;
+      out.flush();
+      out.close();
+      system("systemctl restart tz-data.service");
+    }
+
     SetTimezone(((CSettingString*)setting)->GetValue());
 
     CDateTime::ResetTimezoneBias();
-- 
1.7.2.5

