Skip to content

Commit

Permalink
Fixed setting timezone on RPI
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHae committed Nov 7, 2019
1 parent 5ee2c9c commit 7dab708
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rest_configuration.cpp
Expand Up @@ -264,6 +264,8 @@ void DeRestPluginPrivate::initTimezone()
if (getenv("TZ") != gwTimezone)
{
setenv("TZ", qPrintable(gwTimezone), 1);
//also set zoneinfo on RPI
symlink("/usr/share/zoneinfo/" + timezone, "/etc/localtime");
}
}
tzset();
Expand Down Expand Up @@ -1960,6 +1962,9 @@ int DeRestPluginPrivate::modifyConfig(const ApiRequest &req, ApiResponse &rsp)
int rc = setenv("TZ", qPrintable(timezone), 1);
tzset();

//also set zoneinfo on RPI
symlink("/usr/share/zoneinfo/" + timezone, "/etc/localtime");

if (rc != 0)
{
rsp.list.append(errorToMap(ERR_INTERNAL_ERROR, QString("/config/timezone"), QString("Error setting timezone")));
Expand Down

0 comments on commit 7dab708

Please sign in to comment.