1
0
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
Lakka-rk322x/packages/mediacenter/kodi/patches/kodi-100.08-setup-timezone.patch
2021-01-30 14:45:52 +01:00

41 lines
1.2 KiB
Diff

From 7afdfe63354967ea5123cb2b1746c3ae552d0977 Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Mon, 18 Aug 2014 17:46:54 +0300
Subject: [PATCH] setup timezone
on TZ country setting change, store the value in format
TIMEZONE=Xx/Yyy to /storage/.cache/timezone to be used with
tz-data.service
---
xbmc/platform/posix/PosixTimezone.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/xbmc/platform/posix/PosixTimezone.cpp
+++ b/xbmc/platform/posix/PosixTimezone.cpp
@@ -26,6 +26,8 @@
#include <algorithm>
+#include <fstream>
+
CPosixTimezone::CPosixTimezone()
{
char* line = NULL;
@@ -143,6 +145,16 @@ void CPosixTimezone::OnSettingChanged(co
const std::string &settingId = setting->GetId();
if (settingId == CSettings::SETTING_LOCALE_TIMEZONE)
{
+ std::ofstream out("/storage/.cache/timezone");
+ if (out)
+ {
+ const std::string tz = std::string("TIMEZONE=") + (std::static_pointer_cast<const CSettingString>(setting)->GetValue().c_str());
+ out << tz << std::endl;
+ out.flush();
+ out.close();
+ system("systemctl restart tz-data.service");
+ }
+
SetTimezone(std::static_pointer_cast<const CSettingString>(setting)->GetValue());
CDateTime::ResetTimezoneBias();