From 309f5daf8c8577155fdd20fcbad418f8576c640e Mon Sep 17 00:00:00 2001 From: rladmin Date: Sat, 4 Jan 2020 11:27:16 -0800 Subject: [PATCH] tzset() only needs to be called once at program invokation, not every cycle UTC clock stored in ML1027 --- webserver/core/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webserver/core/main.cpp b/webserver/core/main.cpp index 6640e22..469d7e1 100644 --- a/webserver/core/main.cpp +++ b/webserver/core/main.cpp @@ -159,8 +159,10 @@ void handleSpecialFunctions() struct tm *current_time; time_t rawtime; - tzset(); time(&rawtime); + // store the UTC clock in [%ML1027] + if (special_functions[3] != NULL) *special_functions[3] = rawtime; + current_time = localtime(&rawtime); rawtime = rawtime - timezone; @@ -187,6 +189,7 @@ int main(int argc,char **argv) //====================================================== // PLC INITIALIZATION //====================================================== + tzset(); time(&start_time); pthread_t interactive_thread; pthread_create(&interactive_thread, NULL, interactiveServerThread, NULL);