mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2026-03-28 20:17:11 +01:00
Rework NTP handling
* Use mathieucarbou/MycilaNTP which make the same as the currenet code with further improvements * Remove zones.json file as it is already included in the NTP library now * Remove the "Timezone" property from config as we will only save the time zone name in future (instead of spec + name) * When changing the time zone, the device local time will be updated immidiatly in the web ui
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
#define SYSLOG_MAX_HOSTNAME_STRLEN 128
|
||||
|
||||
#define NTP_MAX_SERVER_STRLEN 31
|
||||
#define NTP_MAX_TIMEZONE_STRLEN 50
|
||||
#define NTP_MAX_TIMEZONEDESCR_STRLEN 50
|
||||
|
||||
#define MQTT_MAX_HOSTNAME_STRLEN 128
|
||||
@@ -93,7 +92,6 @@ struct CONFIG_T {
|
||||
|
||||
struct {
|
||||
char Server[NTP_MAX_SERVER_STRLEN + 1];
|
||||
char Timezone[NTP_MAX_TIMEZONE_STRLEN + 1];
|
||||
char TimezoneDescr[NTP_MAX_TIMEZONEDESCR_STRLEN + 1];
|
||||
double Longitude;
|
||||
double Latitude;
|
||||
|
||||
@@ -14,4 +14,5 @@ private:
|
||||
void onNtpAdminPost(AsyncWebServerRequest* request);
|
||||
void onNtpTimeGet(AsyncWebServerRequest* request);
|
||||
void onNtpTimePost(AsyncWebServerRequest* request);
|
||||
void onNtpTimezonesGet(AsyncWebServerRequest* request);
|
||||
};
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#define NTP_SERVER_OLD "pool.ntp.org"
|
||||
#define NTP_SERVER "opendtu.pool.ntp.org"
|
||||
#define NTP_TIMEZONE "CET-1CEST,M3.5.0,M10.5.0/3"
|
||||
#define NTP_TIMEZONEDESCR "Europe/Berlin"
|
||||
#define NTP_LONGITUDE 10.4515f
|
||||
#define NTP_LATITUDE 51.1657f
|
||||
|
||||
@@ -30,6 +30,7 @@ build_flags =
|
||||
-DCONFIG_ASYNC_TCP_EVENT_QUEUE_SIZE=128
|
||||
-DCONFIG_ASYNC_TCP_QUEUE_SIZE=128
|
||||
-DEMC_TASK_STACK_SIZE=6400
|
||||
-DMYCILA_JSON_SUPPORT
|
||||
; -DHOY_DEBUG_QUEUE
|
||||
|
||||
; Log related defines
|
||||
@@ -57,6 +58,7 @@ lib_deps =
|
||||
olikraus/U8g2 @ 2.36.17
|
||||
buelowp/sunset @ 1.1.7
|
||||
arkhipenko/TaskScheduler @ 3.8.5
|
||||
mathieucarbou/MycilaNTP @ 6.0.5
|
||||
|
||||
extra_scripts =
|
||||
pre:pio-scripts/auto_firmware_version.py
|
||||
@@ -67,7 +69,6 @@ board_build.partitions = partitions_custom_4mb.csv
|
||||
board_build.filesystem = littlefs
|
||||
board_build.embed_files =
|
||||
webapp_dist/index.html.gz
|
||||
webapp_dist/zones.json.gz
|
||||
webapp_dist/favicon.ico
|
||||
webapp_dist/favicon.png
|
||||
webapp_dist/js/app.js.gz
|
||||
|
||||
@@ -66,7 +66,6 @@ bool ConfigurationClass::write()
|
||||
|
||||
JsonObject ntp = doc["ntp"].to<JsonObject>();
|
||||
ntp["server"] = config.Ntp.Server;
|
||||
ntp["timezone"] = config.Ntp.Timezone;
|
||||
ntp["timezone_descr"] = config.Ntp.TimezoneDescr;
|
||||
ntp["latitude"] = config.Ntp.Latitude;
|
||||
ntp["longitude"] = config.Ntp.Longitude;
|
||||
@@ -256,7 +255,6 @@ bool ConfigurationClass::read()
|
||||
|
||||
JsonObject ntp = doc["ntp"];
|
||||
strlcpy(config.Ntp.Server, ntp["server"] | NTP_SERVER, sizeof(config.Ntp.Server));
|
||||
strlcpy(config.Ntp.Timezone, ntp["timezone"] | NTP_TIMEZONE, sizeof(config.Ntp.Timezone));
|
||||
strlcpy(config.Ntp.TimezoneDescr, ntp["timezone_descr"] | NTP_TIMEZONEDESCR, sizeof(config.Ntp.TimezoneDescr));
|
||||
config.Ntp.Latitude = ntp["latitude"] | NTP_LATITUDE;
|
||||
config.Ntp.Longitude = ntp["longitude"] | NTP_LONGITUDE;
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
*/
|
||||
#include "NtpSettings.h"
|
||||
#include "Configuration.h"
|
||||
#include <Arduino.h>
|
||||
#include <time.h>
|
||||
#include <MycilaNTP.h>
|
||||
|
||||
NtpSettingsClass::NtpSettingsClass()
|
||||
{
|
||||
@@ -19,13 +18,12 @@ void NtpSettingsClass::init()
|
||||
|
||||
void NtpSettingsClass::setServer()
|
||||
{
|
||||
configTime(0, 0, Configuration.get().Ntp.Server);
|
||||
Mycila::NTP.sync(Configuration.get().Ntp.Server);
|
||||
}
|
||||
|
||||
void NtpSettingsClass::setTimezone()
|
||||
{
|
||||
setenv("TZ", Configuration.get().Ntp.Timezone, 1);
|
||||
tzset();
|
||||
Mycila::NTP.setTimeZone(Configuration.get().Ntp.TimezoneDescr);
|
||||
}
|
||||
|
||||
NtpSettingsClass NtpSettings;
|
||||
NtpSettingsClass NtpSettings;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "WebApi_errors.h"
|
||||
#include "helper.h"
|
||||
#include <AsyncJson.h>
|
||||
#include <MycilaNTP.h>
|
||||
|
||||
void WebApiNtpClass::init(AsyncWebServer& server, Scheduler& scheduler)
|
||||
{
|
||||
@@ -20,6 +21,7 @@ void WebApiNtpClass::init(AsyncWebServer& server, Scheduler& scheduler)
|
||||
server.on("/api/ntp/config", HTTP_POST, static_cast<ArRequestHandlerFunction>(std::bind(&WebApiNtpClass::onNtpAdminPost, this, _1)));
|
||||
server.on("/api/ntp/time", HTTP_GET, static_cast<ArRequestHandlerFunction>(std::bind(&WebApiNtpClass::onNtpTimeGet, this, _1)));
|
||||
server.on("/api/ntp/time", HTTP_POST, static_cast<ArRequestHandlerFunction>(std::bind(&WebApiNtpClass::onNtpTimePost, this, _1)));
|
||||
server.on("/api/ntp/zones", HTTP_GET, static_cast<ArRequestHandlerFunction>(std::bind(&WebApiNtpClass::onNtpTimezonesGet, this, _1)));
|
||||
}
|
||||
|
||||
void WebApiNtpClass::onNtpStatus(AsyncWebServerRequest* request)
|
||||
@@ -33,15 +35,12 @@ void WebApiNtpClass::onNtpStatus(AsyncWebServerRequest* request)
|
||||
const CONFIG_T& config = Configuration.get();
|
||||
|
||||
root["ntp_server"] = config.Ntp.Server;
|
||||
root["ntp_timezone"] = config.Ntp.Timezone;
|
||||
root["ntp_timezone"] = Mycila::NTP.getTimezoneInfo();
|
||||
root["ntp_timezone_descr"] = config.Ntp.TimezoneDescr;
|
||||
root["ntp_status"] = Mycila::NTP.isSynced();
|
||||
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
root["ntp_status"] = false;
|
||||
} else {
|
||||
root["ntp_status"] = true;
|
||||
}
|
||||
getLocalTime(&timeinfo, 5);
|
||||
char timeStringBuff[50];
|
||||
strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo);
|
||||
root["ntp_localtime"] = timeStringBuff;
|
||||
@@ -77,7 +76,6 @@ void WebApiNtpClass::onNtpAdminGet(AsyncWebServerRequest* request)
|
||||
const CONFIG_T& config = Configuration.get();
|
||||
|
||||
root["ntp_server"] = config.Ntp.Server;
|
||||
root["ntp_timezone"] = config.Ntp.Timezone;
|
||||
root["ntp_timezone_descr"] = config.Ntp.TimezoneDescr;
|
||||
root["longitude"] = config.Ntp.Longitude;
|
||||
root["latitude"] = config.Ntp.Latitude;
|
||||
@@ -101,7 +99,7 @@ void WebApiNtpClass::onNtpAdminPost(AsyncWebServerRequest* request)
|
||||
auto& retMsg = response->getRoot();
|
||||
|
||||
if (!(root["ntp_server"].is<String>()
|
||||
&& root["ntp_timezone"].is<String>()
|
||||
&& root["ntp_timezone_descr"].is<String>()
|
||||
&& root["longitude"].is<double>()
|
||||
&& root["latitude"].is<double>()
|
||||
&& root["sunsettype"].is<uint8_t>())) {
|
||||
@@ -119,14 +117,6 @@ void WebApiNtpClass::onNtpAdminPost(AsyncWebServerRequest* request)
|
||||
return;
|
||||
}
|
||||
|
||||
if (root["ntp_timezone"].as<String>().length() == 0 || root["ntp_timezone"].as<String>().length() > NTP_MAX_TIMEZONE_STRLEN) {
|
||||
retMsg["message"] = "Timezone must between 1 and " STR_EXTRACT(NTP_MAX_TIMEZONE_STRLEN) " characters long!";
|
||||
retMsg["code"] = WebApiError::NtpTimezoneLength;
|
||||
retMsg["param"]["max"] = NTP_MAX_TIMEZONE_STRLEN;
|
||||
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (root["ntp_timezone_descr"].as<String>().length() == 0 || root["ntp_timezone_descr"].as<String>().length() > NTP_MAX_TIMEZONEDESCR_STRLEN) {
|
||||
retMsg["message"] = "Timezone description must between 1 and " STR_EXTRACT(NTP_MAX_TIMEZONEDESCR_STRLEN) " characters long!";
|
||||
retMsg["code"] = WebApiError::NtpTimezoneDescriptionLength;
|
||||
@@ -140,7 +130,6 @@ void WebApiNtpClass::onNtpAdminPost(AsyncWebServerRequest* request)
|
||||
auto& config = guard.getConfig();
|
||||
|
||||
strlcpy(config.Ntp.Server, root["ntp_server"].as<String>().c_str(), sizeof(config.Ntp.Server));
|
||||
strlcpy(config.Ntp.Timezone, root["ntp_timezone"].as<String>().c_str(), sizeof(config.Ntp.Timezone));
|
||||
strlcpy(config.Ntp.TimezoneDescr, root["ntp_timezone_descr"].as<String>().c_str(), sizeof(config.Ntp.TimezoneDescr));
|
||||
config.Ntp.Latitude = root["latitude"].as<double>();
|
||||
config.Ntp.Longitude = root["longitude"].as<double>();
|
||||
@@ -151,8 +140,8 @@ void WebApiNtpClass::onNtpAdminPost(AsyncWebServerRequest* request)
|
||||
|
||||
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
|
||||
|
||||
NtpSettings.setServer();
|
||||
NtpSettings.setTimezone();
|
||||
NtpSettings.setServer();
|
||||
|
||||
SunPosition.setDoRecalc(true);
|
||||
}
|
||||
@@ -274,7 +263,7 @@ void WebApiNtpClass::onNtpTimePost(AsyncWebServerRequest* request)
|
||||
|
||||
time_t t = mktime(&local);
|
||||
struct timeval now = { .tv_sec = t, .tv_usec = 0 };
|
||||
settimeofday(&now, NULL);
|
||||
Mycila::NTP.sync(now);
|
||||
|
||||
retMsg["type"] = "success";
|
||||
retMsg["message"] = "Time updated!";
|
||||
@@ -282,3 +271,17 @@ void WebApiNtpClass::onNtpTimePost(AsyncWebServerRequest* request)
|
||||
|
||||
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
void WebApiNtpClass::onNtpTimezonesGet(AsyncWebServerRequest* request)
|
||||
{
|
||||
if (!WebApi.checkCredentialsReadonly(request)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AsyncJsonResponse* response = new AsyncJsonResponse();
|
||||
auto& root = response->getRoot();
|
||||
|
||||
Mycila::NTP.timezonesToJsonObject(root);
|
||||
|
||||
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@@ -9,14 +9,12 @@
|
||||
extern const uint8_t file_index_html_start[] asm("_binary_webapp_dist_index_html_gz_start");
|
||||
extern const uint8_t file_favicon_ico_start[] asm("_binary_webapp_dist_favicon_ico_start");
|
||||
extern const uint8_t file_favicon_png_start[] asm("_binary_webapp_dist_favicon_png_start");
|
||||
extern const uint8_t file_zones_json_start[] asm("_binary_webapp_dist_zones_json_gz_start");
|
||||
extern const uint8_t file_app_js_start[] asm("_binary_webapp_dist_js_app_js_gz_start");
|
||||
extern const uint8_t file_site_webmanifest_start[] asm("_binary_webapp_dist_site_webmanifest_start");
|
||||
|
||||
extern const uint8_t file_index_html_end[] asm("_binary_webapp_dist_index_html_gz_end");
|
||||
extern const uint8_t file_favicon_ico_end[] asm("_binary_webapp_dist_favicon_ico_end");
|
||||
extern const uint8_t file_favicon_png_end[] asm("_binary_webapp_dist_favicon_png_end");
|
||||
extern const uint8_t file_zones_json_end[] asm("_binary_webapp_dist_zones_json_gz_end");
|
||||
extern const uint8_t file_app_js_end[] asm("_binary_webapp_dist_js_app_js_gz_end");
|
||||
extern const uint8_t file_site_webmanifest_end[] asm("_binary_webapp_dist_site_webmanifest_end");
|
||||
|
||||
@@ -27,7 +25,7 @@ void WebApiWebappClass::responseBinaryDataWithETagCache(AsyncWebServerRequest* r
|
||||
md5.add(const_cast<uint8_t*>(content), len);
|
||||
|
||||
// ensure ETag uniqueness per version by including Git commit hash. force
|
||||
// browsers to reload dependent resources like app.js and zones.json even
|
||||
// browsers to reload dependent resources like app.js even
|
||||
// when index.html content hasn't actually changed between versions.
|
||||
md5.add(String(__COMPILED_GIT_HASH__));
|
||||
|
||||
@@ -89,10 +87,6 @@ void WebApiWebappClass::init(AsyncWebServer& server, Scheduler& scheduler)
|
||||
responseBinaryDataWithETagCache(request, asyncsrv::T_image_png, "", file_favicon_png_start, file_favicon_png_end - file_favicon_png_start);
|
||||
});
|
||||
|
||||
server.on("/zones.json", HTTP_GET, [&](AsyncWebServerRequest* request) {
|
||||
responseBinaryDataWithETagCache(request, asyncsrv::T_application_json, asyncsrv::T_gzip, file_zones_json_start, file_zones_json_end - file_zones_json_start);
|
||||
});
|
||||
|
||||
server.on("/site.webmanifest", HTTP_GET, [&](AsyncWebServerRequest* request) {
|
||||
responseBinaryDataWithETagCache(request, asyncsrv::T_application_json, "", file_site_webmanifest_start, file_site_webmanifest_end - file_site_webmanifest_start);
|
||||
});
|
||||
|
||||
@@ -1,463 +0,0 @@
|
||||
{
|
||||
"Africa/Abidjan":"GMT0",
|
||||
"Africa/Accra":"GMT0",
|
||||
"Africa/Addis_Ababa":"EAT-3",
|
||||
"Africa/Algiers":"CET-1",
|
||||
"Africa/Asmara":"EAT-3",
|
||||
"Africa/Bamako":"GMT0",
|
||||
"Africa/Bangui":"WAT-1",
|
||||
"Africa/Banjul":"GMT0",
|
||||
"Africa/Bissau":"GMT0",
|
||||
"Africa/Blantyre":"CAT-2",
|
||||
"Africa/Brazzaville":"WAT-1",
|
||||
"Africa/Bujumbura":"CAT-2",
|
||||
"Africa/Cairo":"EET-2EEST,M4.5.5/0,M10.5.4/24",
|
||||
"Africa/Casablanca":"<+01>-1",
|
||||
"Africa/Ceuta":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Africa/Conakry":"GMT0",
|
||||
"Africa/Dakar":"GMT0",
|
||||
"Africa/Dar_es_Salaam":"EAT-3",
|
||||
"Africa/Djibouti":"EAT-3",
|
||||
"Africa/Douala":"WAT-1",
|
||||
"Africa/El_Aaiun":"<+01>-1",
|
||||
"Africa/Freetown":"GMT0",
|
||||
"Africa/Gaborone":"CAT-2",
|
||||
"Africa/Harare":"CAT-2",
|
||||
"Africa/Johannesburg":"SAST-2",
|
||||
"Africa/Juba":"CAT-2",
|
||||
"Africa/Kampala":"EAT-3",
|
||||
"Africa/Khartoum":"CAT-2",
|
||||
"Africa/Kigali":"CAT-2",
|
||||
"Africa/Kinshasa":"WAT-1",
|
||||
"Africa/Lagos":"WAT-1",
|
||||
"Africa/Libreville":"WAT-1",
|
||||
"Africa/Lome":"GMT0",
|
||||
"Africa/Luanda":"WAT-1",
|
||||
"Africa/Lubumbashi":"CAT-2",
|
||||
"Africa/Lusaka":"CAT-2",
|
||||
"Africa/Malabo":"WAT-1",
|
||||
"Africa/Maputo":"CAT-2",
|
||||
"Africa/Maseru":"SAST-2",
|
||||
"Africa/Mbabane":"SAST-2",
|
||||
"Africa/Mogadishu":"EAT-3",
|
||||
"Africa/Monrovia":"GMT0",
|
||||
"Africa/Nairobi":"EAT-3",
|
||||
"Africa/Ndjamena":"WAT-1",
|
||||
"Africa/Niamey":"WAT-1",
|
||||
"Africa/Nouakchott":"GMT0",
|
||||
"Africa/Ouagadougou":"GMT0",
|
||||
"Africa/Porto-Novo":"WAT-1",
|
||||
"Africa/Sao_Tome":"GMT0",
|
||||
"Africa/Tripoli":"EET-2",
|
||||
"Africa/Tunis":"CET-1",
|
||||
"Africa/Windhoek":"CAT-2",
|
||||
"America/Adak":"HST10HDT,M3.2.0,M11.1.0",
|
||||
"America/Anchorage":"AKST9AKDT,M3.2.0,M11.1.0",
|
||||
"America/Anguilla":"AST4",
|
||||
"America/Antigua":"AST4",
|
||||
"America/Araguaina":"<-03>3",
|
||||
"America/Argentina/Buenos_Aires":"<-03>3",
|
||||
"America/Argentina/Catamarca":"<-03>3",
|
||||
"America/Argentina/Cordoba":"<-03>3",
|
||||
"America/Argentina/Jujuy":"<-03>3",
|
||||
"America/Argentina/La_Rioja":"<-03>3",
|
||||
"America/Argentina/Mendoza":"<-03>3",
|
||||
"America/Argentina/Rio_Gallegos":"<-03>3",
|
||||
"America/Argentina/Salta":"<-03>3",
|
||||
"America/Argentina/San_Juan":"<-03>3",
|
||||
"America/Argentina/San_Luis":"<-03>3",
|
||||
"America/Argentina/Tucuman":"<-03>3",
|
||||
"America/Argentina/Ushuaia":"<-03>3",
|
||||
"America/Aruba":"AST4",
|
||||
"America/Asuncion":"<-04>4<-03>,M10.1.0/0,M3.4.0/0",
|
||||
"America/Atikokan":"EST5",
|
||||
"America/Bahia":"<-03>3",
|
||||
"America/Bahia_Banderas":"CST6",
|
||||
"America/Barbados":"AST4",
|
||||
"America/Belem":"<-03>3",
|
||||
"America/Belize":"CST6",
|
||||
"America/Blanc-Sablon":"AST4",
|
||||
"America/Boa_Vista":"<-04>4",
|
||||
"America/Bogota":"<-05>5",
|
||||
"America/Boise":"MST7MDT,M3.2.0,M11.1.0",
|
||||
"America/Cambridge_Bay":"MST7MDT,M3.2.0,M11.1.0",
|
||||
"America/Campo_Grande":"<-04>4",
|
||||
"America/Cancun":"EST5",
|
||||
"America/Caracas":"<-04>4",
|
||||
"America/Cayenne":"<-03>3",
|
||||
"America/Cayman":"EST5",
|
||||
"America/Chicago":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Chihuahua":"CST6",
|
||||
"America/Costa_Rica":"CST6",
|
||||
"America/Creston":"MST7",
|
||||
"America/Cuiaba":"<-04>4",
|
||||
"America/Curacao":"AST4",
|
||||
"America/Danmarkshavn":"GMT0",
|
||||
"America/Dawson":"MST7",
|
||||
"America/Dawson_Creek":"MST7",
|
||||
"America/Denver":"MST7MDT,M3.2.0,M11.1.0",
|
||||
"America/Detroit":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Dominica":"AST4",
|
||||
"America/Edmonton":"MST7MDT,M3.2.0,M11.1.0",
|
||||
"America/Eirunepe":"<-05>5",
|
||||
"America/El_Salvador":"CST6",
|
||||
"America/Fort_Nelson":"MST7",
|
||||
"America/Fortaleza":"<-03>3",
|
||||
"America/Glace_Bay":"AST4ADT,M3.2.0,M11.1.0",
|
||||
"America/Godthab":"<-02>2<-01>,M3.5.0/-1,M10.5.0/0",
|
||||
"America/Goose_Bay":"AST4ADT,M3.2.0,M11.1.0",
|
||||
"America/Grand_Turk":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Grenada":"AST4",
|
||||
"America/Guadeloupe":"AST4",
|
||||
"America/Guatemala":"CST6",
|
||||
"America/Guayaquil":"<-05>5",
|
||||
"America/Guyana":"<-04>4",
|
||||
"America/Halifax":"AST4ADT,M3.2.0,M11.1.0",
|
||||
"America/Havana":"CST5CDT,M3.2.0/0,M11.1.0/1",
|
||||
"America/Hermosillo":"MST7",
|
||||
"America/Indiana/Indianapolis":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Indiana/Knox":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Indiana/Marengo":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Indiana/Petersburg":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Indiana/Tell_City":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Indiana/Vevay":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Indiana/Vincennes":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Indiana/Winamac":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Inuvik":"MST7MDT,M3.2.0,M11.1.0",
|
||||
"America/Iqaluit":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Jamaica":"EST5",
|
||||
"America/Juneau":"AKST9AKDT,M3.2.0,M11.1.0",
|
||||
"America/Kentucky/Louisville":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Kentucky/Monticello":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Kralendijk":"AST4",
|
||||
"America/La_Paz":"<-04>4",
|
||||
"America/Lima":"<-05>5",
|
||||
"America/Los_Angeles":"PST8PDT,M3.2.0,M11.1.0",
|
||||
"America/Lower_Princes":"AST4",
|
||||
"America/Maceio":"<-03>3",
|
||||
"America/Managua":"CST6",
|
||||
"America/Manaus":"<-04>4",
|
||||
"America/Marigot":"AST4",
|
||||
"America/Martinique":"AST4",
|
||||
"America/Matamoros":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Mazatlan":"MST7",
|
||||
"America/Menominee":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Merida":"CST6",
|
||||
"America/Metlakatla":"AKST9AKDT,M3.2.0,M11.1.0",
|
||||
"America/Mexico_City":"CST6",
|
||||
"America/Miquelon":"<-03>3<-02>,M3.2.0,M11.1.0",
|
||||
"America/Moncton":"AST4ADT,M3.2.0,M11.1.0",
|
||||
"America/Monterrey":"CST6",
|
||||
"America/Montevideo":"<-03>3",
|
||||
"America/Montreal":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Montserrat":"AST4",
|
||||
"America/Nassau":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/New_York":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Nipigon":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Nome":"AKST9AKDT,M3.2.0,M11.1.0",
|
||||
"America/Noronha":"<-02>2",
|
||||
"America/North_Dakota/Beulah":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/North_Dakota/Center":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/North_Dakota/New_Salem":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Nuuk":"<-02>2<-01>,M3.5.0/-1,M10.5.0/0",
|
||||
"America/Ojinaga":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Panama":"EST5",
|
||||
"America/Pangnirtung":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Paramaribo":"<-03>3",
|
||||
"America/Phoenix":"MST7",
|
||||
"America/Port-au-Prince":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Port_of_Spain":"AST4",
|
||||
"America/Porto_Velho":"<-04>4",
|
||||
"America/Puerto_Rico":"AST4",
|
||||
"America/Punta_Arenas":"<-03>3",
|
||||
"America/Rainy_River":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Rankin_Inlet":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Recife":"<-03>3",
|
||||
"America/Regina":"CST6",
|
||||
"America/Resolute":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Rio_Branco":"<-05>5",
|
||||
"America/Santarem":"<-03>3",
|
||||
"America/Santiago":"<-04>4<-03>,M9.1.6/24,M4.1.6/24",
|
||||
"America/Santo_Domingo":"AST4",
|
||||
"America/Sao_Paulo":"<-03>3",
|
||||
"America/Scoresbysund":"<-02>2<-01>,M3.5.0/-1,M10.5.0/0",
|
||||
"America/Sitka":"AKST9AKDT,M3.2.0,M11.1.0",
|
||||
"America/St_Barthelemy":"AST4",
|
||||
"America/St_Johns":"NST3:30NDT,M3.2.0,M11.1.0",
|
||||
"America/St_Kitts":"AST4",
|
||||
"America/St_Lucia":"AST4",
|
||||
"America/St_Thomas":"AST4",
|
||||
"America/St_Vincent":"AST4",
|
||||
"America/Swift_Current":"CST6",
|
||||
"America/Tegucigalpa":"CST6",
|
||||
"America/Thule":"AST4ADT,M3.2.0,M11.1.0",
|
||||
"America/Thunder_Bay":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Tijuana":"PST8PDT,M3.2.0,M11.1.0",
|
||||
"America/Toronto":"EST5EDT,M3.2.0,M11.1.0",
|
||||
"America/Tortola":"AST4",
|
||||
"America/Vancouver":"PST8PDT,M3.2.0,M11.1.0",
|
||||
"America/Whitehorse":"MST7",
|
||||
"America/Winnipeg":"CST6CDT,M3.2.0,M11.1.0",
|
||||
"America/Yakutat":"AKST9AKDT,M3.2.0,M11.1.0",
|
||||
"America/Yellowknife":"MST7MDT,M3.2.0,M11.1.0",
|
||||
"Antarctica/Casey":"<+08>-8",
|
||||
"Antarctica/Davis":"<+07>-7",
|
||||
"Antarctica/DumontDUrville":"<+10>-10",
|
||||
"Antarctica/Macquarie":"AEST-10AEDT,M10.1.0,M4.1.0/3",
|
||||
"Antarctica/Mawson":"<+05>-5",
|
||||
"Antarctica/McMurdo":"NZST-12NZDT,M9.5.0,M4.1.0/3",
|
||||
"Antarctica/Palmer":"<-03>3",
|
||||
"Antarctica/Rothera":"<-03>3",
|
||||
"Antarctica/Syowa":"<+03>-3",
|
||||
"Antarctica/Troll":"<+00>0<+02>-2,M3.5.0/1,M10.5.0/3",
|
||||
"Antarctica/Vostok":"<+05>-5",
|
||||
"Arctic/Longyearbyen":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Asia/Aden":"<+03>-3",
|
||||
"Asia/Almaty":"<+05>-5",
|
||||
"Asia/Amman":"<+03>-3",
|
||||
"Asia/Anadyr":"<+12>-12",
|
||||
"Asia/Aqtau":"<+05>-5",
|
||||
"Asia/Aqtobe":"<+05>-5",
|
||||
"Asia/Ashgabat":"<+05>-5",
|
||||
"Asia/Atyrau":"<+05>-5",
|
||||
"Asia/Baghdad":"<+03>-3",
|
||||
"Asia/Bahrain":"<+03>-3",
|
||||
"Asia/Baku":"<+04>-4",
|
||||
"Asia/Bangkok":"<+07>-7",
|
||||
"Asia/Barnaul":"<+07>-7",
|
||||
"Asia/Beirut":"EET-2EEST,M3.5.0/0,M10.5.0/0",
|
||||
"Asia/Bishkek":"<+06>-6",
|
||||
"Asia/Brunei":"<+08>-8",
|
||||
"Asia/Chita":"<+09>-9",
|
||||
"Asia/Choibalsan":"<+08>-8",
|
||||
"Asia/Colombo":"<+0530>-5:30",
|
||||
"Asia/Damascus":"<+03>-3",
|
||||
"Asia/Dhaka":"<+06>-6",
|
||||
"Asia/Dili":"<+09>-9",
|
||||
"Asia/Dubai":"<+04>-4",
|
||||
"Asia/Dushanbe":"<+05>-5",
|
||||
"Asia/Famagusta":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Asia/Gaza":"EET-2EEST,M3.4.4/50,M10.4.4/50",
|
||||
"Asia/Hebron":"EET-2EEST,M3.4.4/50,M10.4.4/50",
|
||||
"Asia/Ho_Chi_Minh":"<+07>-7",
|
||||
"Asia/Hong_Kong":"HKT-8",
|
||||
"Asia/Hovd":"<+07>-7",
|
||||
"Asia/Irkutsk":"<+08>-8",
|
||||
"Asia/Jakarta":"WIB-7",
|
||||
"Asia/Jayapura":"WIT-9",
|
||||
"Asia/Jerusalem":"IST-2IDT,M3.4.4/26,M10.5.0",
|
||||
"Asia/Kabul":"<+0430>-4:30",
|
||||
"Asia/Kamchatka":"<+12>-12",
|
||||
"Asia/Karachi":"PKT-5",
|
||||
"Asia/Kathmandu":"<+0545>-5:45",
|
||||
"Asia/Khandyga":"<+09>-9",
|
||||
"Asia/Kolkata":"IST-5:30",
|
||||
"Asia/Krasnoyarsk":"<+07>-7",
|
||||
"Asia/Kuala_Lumpur":"<+08>-8",
|
||||
"Asia/Kuching":"<+08>-8",
|
||||
"Asia/Kuwait":"<+03>-3",
|
||||
"Asia/Macau":"CST-8",
|
||||
"Asia/Magadan":"<+11>-11",
|
||||
"Asia/Makassar":"WITA-8",
|
||||
"Asia/Manila":"PST-8",
|
||||
"Asia/Muscat":"<+04>-4",
|
||||
"Asia/Nicosia":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Asia/Novokuznetsk":"<+07>-7",
|
||||
"Asia/Novosibirsk":"<+07>-7",
|
||||
"Asia/Omsk":"<+06>-6",
|
||||
"Asia/Oral":"<+05>-5",
|
||||
"Asia/Phnom_Penh":"<+07>-7",
|
||||
"Asia/Pontianak":"WIB-7",
|
||||
"Asia/Pyongyang":"KST-9",
|
||||
"Asia/Qatar":"<+03>-3",
|
||||
"Asia/Qyzylorda":"<+05>-5",
|
||||
"Asia/Riyadh":"<+03>-3",
|
||||
"Asia/Sakhalin":"<+11>-11",
|
||||
"Asia/Samarkand":"<+05>-5",
|
||||
"Asia/Seoul":"KST-9",
|
||||
"Asia/Shanghai":"CST-8",
|
||||
"Asia/Singapore":"<+08>-8",
|
||||
"Asia/Srednekolymsk":"<+11>-11",
|
||||
"Asia/Taipei":"CST-8",
|
||||
"Asia/Tashkent":"<+05>-5",
|
||||
"Asia/Tbilisi":"<+04>-4",
|
||||
"Asia/Tehran":"<+0330>-3:30",
|
||||
"Asia/Thimphu":"<+06>-6",
|
||||
"Asia/Tokyo":"JST-9",
|
||||
"Asia/Tomsk":"<+07>-7",
|
||||
"Asia/Ulaanbaatar":"<+08>-8",
|
||||
"Asia/Urumqi":"<+06>-6",
|
||||
"Asia/Ust-Nera":"<+10>-10",
|
||||
"Asia/Vientiane":"<+07>-7",
|
||||
"Asia/Vladivostok":"<+10>-10",
|
||||
"Asia/Yakutsk":"<+09>-9",
|
||||
"Asia/Yangon":"<+0630>-6:30",
|
||||
"Asia/Yekaterinburg":"<+05>-5",
|
||||
"Asia/Yerevan":"<+04>-4",
|
||||
"Atlantic/Azores":"<-01>1<+00>,M3.5.0/0,M10.5.0/1",
|
||||
"Atlantic/Bermuda":"AST4ADT,M3.2.0,M11.1.0",
|
||||
"Atlantic/Canary":"WET0WEST,M3.5.0/1,M10.5.0",
|
||||
"Atlantic/Cape_Verde":"<-01>1",
|
||||
"Atlantic/Faroe":"WET0WEST,M3.5.0/1,M10.5.0",
|
||||
"Atlantic/Madeira":"WET0WEST,M3.5.0/1,M10.5.0",
|
||||
"Atlantic/Reykjavik":"GMT0",
|
||||
"Atlantic/South_Georgia":"<-02>2",
|
||||
"Atlantic/St_Helena":"GMT0",
|
||||
"Atlantic/Stanley":"<-03>3",
|
||||
"Australia/Adelaide":"ACST-9:30ACDT,M10.1.0,M4.1.0/3",
|
||||
"Australia/Brisbane":"AEST-10",
|
||||
"Australia/Broken_Hill":"ACST-9:30ACDT,M10.1.0,M4.1.0/3",
|
||||
"Australia/Currie":"AEST-10AEDT,M10.1.0,M4.1.0/3",
|
||||
"Australia/Darwin":"ACST-9:30",
|
||||
"Australia/Eucla":"<+0845>-8:45",
|
||||
"Australia/Hobart":"AEST-10AEDT,M10.1.0,M4.1.0/3",
|
||||
"Australia/Lindeman":"AEST-10",
|
||||
"Australia/Lord_Howe":"<+1030>-10:30<+11>-11,M10.1.0,M4.1.0",
|
||||
"Australia/Melbourne":"AEST-10AEDT,M10.1.0,M4.1.0/3",
|
||||
"Australia/Perth":"AWST-8",
|
||||
"Australia/Sydney":"AEST-10AEDT,M10.1.0,M4.1.0/3",
|
||||
"Etc/GMT":"GMT0",
|
||||
"Etc/GMT+0":"GMT0",
|
||||
"Etc/GMT+1":"<-01>1",
|
||||
"Etc/GMT+10":"<-10>10",
|
||||
"Etc/GMT+11":"<-11>11",
|
||||
"Etc/GMT+12":"<-12>12",
|
||||
"Etc/GMT+2":"<-02>2",
|
||||
"Etc/GMT+3":"<-03>3",
|
||||
"Etc/GMT+4":"<-04>4",
|
||||
"Etc/GMT+5":"<-05>5",
|
||||
"Etc/GMT+6":"<-06>6",
|
||||
"Etc/GMT+7":"<-07>7",
|
||||
"Etc/GMT+8":"<-08>8",
|
||||
"Etc/GMT+9":"<-09>9",
|
||||
"Etc/GMT-0":"GMT0",
|
||||
"Etc/GMT-1":"<+01>-1",
|
||||
"Etc/GMT-10":"<+10>-10",
|
||||
"Etc/GMT-11":"<+11>-11",
|
||||
"Etc/GMT-12":"<+12>-12",
|
||||
"Etc/GMT-13":"<+13>-13",
|
||||
"Etc/GMT-14":"<+14>-14",
|
||||
"Etc/GMT-2":"<+02>-2",
|
||||
"Etc/GMT-3":"<+03>-3",
|
||||
"Etc/GMT-4":"<+04>-4",
|
||||
"Etc/GMT-5":"<+05>-5",
|
||||
"Etc/GMT-6":"<+06>-6",
|
||||
"Etc/GMT-7":"<+07>-7",
|
||||
"Etc/GMT-8":"<+08>-8",
|
||||
"Etc/GMT-9":"<+09>-9",
|
||||
"Etc/GMT0":"GMT0",
|
||||
"Etc/Greenwich":"GMT0",
|
||||
"Etc/UCT":"UTC0",
|
||||
"Etc/UTC":"UTC0",
|
||||
"Etc/Universal":"UTC0",
|
||||
"Etc/Zulu":"UTC0",
|
||||
"Europe/Amsterdam":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Andorra":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Astrakhan":"<+04>-4",
|
||||
"Europe/Athens":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Belgrade":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Berlin":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Bratislava":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Brussels":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Bucharest":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Budapest":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Busingen":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Chisinau":"EET-2EEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Copenhagen":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Dublin":"IST-1GMT0,M10.5.0,M3.5.0/1",
|
||||
"Europe/Gibraltar":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Guernsey":"GMT0BST,M3.5.0/1,M10.5.0",
|
||||
"Europe/Helsinki":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Isle_of_Man":"GMT0BST,M3.5.0/1,M10.5.0",
|
||||
"Europe/Istanbul":"<+03>-3",
|
||||
"Europe/Jersey":"GMT0BST,M3.5.0/1,M10.5.0",
|
||||
"Europe/Kaliningrad":"EET-2",
|
||||
"Europe/Kiev":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Kirov":"MSK-3",
|
||||
"Europe/Lisbon":"WET0WEST,M3.5.0/1,M10.5.0",
|
||||
"Europe/Ljubljana":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/London":"GMT0BST,M3.5.0/1,M10.5.0",
|
||||
"Europe/Luxembourg":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Madrid":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Malta":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Mariehamn":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Minsk":"<+03>-3",
|
||||
"Europe/Monaco":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Moscow":"MSK-3",
|
||||
"Europe/Oslo":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Paris":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Podgorica":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Prague":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Riga":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Rome":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Samara":"<+04>-4",
|
||||
"Europe/San_Marino":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Sarajevo":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Saratov":"<+04>-4",
|
||||
"Europe/Simferopol":"MSK-3",
|
||||
"Europe/Skopje":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Sofia":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Stockholm":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Tallinn":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Tirane":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Ulyanovsk":"<+04>-4",
|
||||
"Europe/Uzhgorod":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Vaduz":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Vatican":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Vienna":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Vilnius":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Volgograd":"MSK-3",
|
||||
"Europe/Warsaw":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Zagreb":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Europe/Zaporozhye":"EET-2EEST,M3.5.0/3,M10.5.0/4",
|
||||
"Europe/Zurich":"CET-1CEST,M3.5.0,M10.5.0/3",
|
||||
"Indian/Antananarivo":"EAT-3",
|
||||
"Indian/Chagos":"<+06>-6",
|
||||
"Indian/Christmas":"<+07>-7",
|
||||
"Indian/Cocos":"<+0630>-6:30",
|
||||
"Indian/Comoro":"EAT-3",
|
||||
"Indian/Kerguelen":"<+05>-5",
|
||||
"Indian/Mahe":"<+04>-4",
|
||||
"Indian/Maldives":"<+05>-5",
|
||||
"Indian/Mauritius":"<+04>-4",
|
||||
"Indian/Mayotte":"EAT-3",
|
||||
"Indian/Reunion":"<+04>-4",
|
||||
"Pacific/Apia":"<+13>-13",
|
||||
"Pacific/Auckland":"NZST-12NZDT,M9.5.0,M4.1.0/3",
|
||||
"Pacific/Bougainville":"<+11>-11",
|
||||
"Pacific/Chatham":"<+1245>-12:45<+1345>,M9.5.0/2:45,M4.1.0/3:45",
|
||||
"Pacific/Chuuk":"<+10>-10",
|
||||
"Pacific/Easter":"<-06>6<-05>,M9.1.6/22,M4.1.6/22",
|
||||
"Pacific/Efate":"<+11>-11",
|
||||
"Pacific/Enderbury":"<+13>-13",
|
||||
"Pacific/Fakaofo":"<+13>-13",
|
||||
"Pacific/Fiji":"<+12>-12",
|
||||
"Pacific/Funafuti":"<+12>-12",
|
||||
"Pacific/Galapagos":"<-06>6",
|
||||
"Pacific/Gambier":"<-09>9",
|
||||
"Pacific/Guadalcanal":"<+11>-11",
|
||||
"Pacific/Guam":"ChST-10",
|
||||
"Pacific/Honolulu":"HST10",
|
||||
"Pacific/Kiritimati":"<+14>-14",
|
||||
"Pacific/Kosrae":"<+11>-11",
|
||||
"Pacific/Kwajalein":"<+12>-12",
|
||||
"Pacific/Majuro":"<+12>-12",
|
||||
"Pacific/Marquesas":"<-0930>9:30",
|
||||
"Pacific/Midway":"SST11",
|
||||
"Pacific/Nauru":"<+12>-12",
|
||||
"Pacific/Niue":"<-11>11",
|
||||
"Pacific/Norfolk":"<+11>-11<+12>,M10.1.0,M4.1.0/3",
|
||||
"Pacific/Noumea":"<+11>-11",
|
||||
"Pacific/Pago_Pago":"SST11",
|
||||
"Pacific/Palau":"<+09>-9",
|
||||
"Pacific/Pitcairn":"<-08>8",
|
||||
"Pacific/Pohnpei":"<+11>-11",
|
||||
"Pacific/Port_Moresby":"<+10>-10",
|
||||
"Pacific/Rarotonga":"<-10>10",
|
||||
"Pacific/Saipan":"ChST-10",
|
||||
"Pacific/Tahiti":"<-10>10",
|
||||
"Pacific/Tarawa":"<+12>-12",
|
||||
"Pacific/Tongatapu":"<+13>-13",
|
||||
"Pacific/Wake":"<+12>-12",
|
||||
"Pacific/Wallis":"<+12>-12"
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
export interface NtpConfig {
|
||||
ntp_server: string;
|
||||
ntp_timezone: string;
|
||||
ntp_timezone_descr: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
|
||||
@@ -23,11 +23,7 @@
|
||||
<label for="inputTimezone" class="col-sm-2 col-form-label">{{ $t('ntpadmin.Timezone') }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-select" v-model="timezoneSelect">
|
||||
<option
|
||||
v-for="(config, name) in timezoneList"
|
||||
:key="name + '---' + config"
|
||||
:value="name + '---' + config"
|
||||
>
|
||||
<option v-for="name in Object.keys(timezoneList ?? {})" :key="name" :value="name">
|
||||
{{ name }}
|
||||
</option>
|
||||
</select>
|
||||
@@ -36,7 +32,7 @@
|
||||
|
||||
<InputElement
|
||||
:label="$t('ntpadmin.TimezoneConfig')"
|
||||
v-model="ntpConfigList.ntp_timezone"
|
||||
v-model="timezoneInfo"
|
||||
type="text"
|
||||
maxlength="32"
|
||||
disabled
|
||||
@@ -120,8 +116,9 @@ export default defineComponent({
|
||||
dataLoading: true,
|
||||
timezoneLoading: true,
|
||||
ntpConfigList: {} as NtpConfig,
|
||||
timezoneList: {},
|
||||
timezoneList: {} as Record<string, string>,
|
||||
timezoneSelect: '',
|
||||
timezoneInfo: '',
|
||||
mcuTime: new Date(),
|
||||
localTime: new Date(),
|
||||
dataAgeInterval: 0,
|
||||
@@ -136,13 +133,12 @@ export default defineComponent({
|
||||
},
|
||||
watch: {
|
||||
timezoneSelect: function (newValue) {
|
||||
this.ntpConfigList.ntp_timezone = newValue.split('---')[1];
|
||||
this.ntpConfigList.ntp_timezone_descr = newValue.split('---')[0];
|
||||
this.timezoneInfo = this.timezoneList[newValue] ?? '';
|
||||
this.ntpConfigList.ntp_timezone_descr = newValue;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getTimezoneList();
|
||||
this.getNtpConfig();
|
||||
this.getCurrentTime();
|
||||
this.initDataAgeing();
|
||||
},
|
||||
@@ -155,11 +151,12 @@ export default defineComponent({
|
||||
},
|
||||
getTimezoneList() {
|
||||
this.timezoneLoading = true;
|
||||
fetch('/zones.json')
|
||||
fetch('/api/ntp/zones')
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
this.timezoneList = data;
|
||||
this.timezoneLoading = false;
|
||||
this.getNtpConfig();
|
||||
});
|
||||
},
|
||||
getNtpConfig() {
|
||||
@@ -168,8 +165,7 @@ export default defineComponent({
|
||||
.then((response) => handleResponse(response, this.$emitter, this.$router))
|
||||
.then((data) => {
|
||||
this.ntpConfigList = data;
|
||||
this.timezoneSelect =
|
||||
this.ntpConfigList.ntp_timezone_descr + '---' + this.ntpConfigList.ntp_timezone;
|
||||
this.timezoneSelect = this.ntpConfigList.ntp_timezone_descr;
|
||||
this.dataLoading = false;
|
||||
});
|
||||
},
|
||||
@@ -226,6 +222,9 @@ export default defineComponent({
|
||||
this.alert.message = this.$t('apiresponse.' + response.code, response.param);
|
||||
this.alert.type = response.type;
|
||||
this.alert.show = true;
|
||||
})
|
||||
.then(() => {
|
||||
this.getCurrentTime();
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user