tzset() only needs to be called once at program invokation, not every cycle

UTC clock stored in ML1027
This commit is contained in:
rladmin 2020-01-04 11:27:16 -08:00
parent 3e59bbf74a
commit 309f5daf8c
1 changed files with 4 additions and 1 deletions

View File

@ -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);