plcforum.uz.ua

International PLC Forum
It is currently Tue Nov 13, 2018 6:40 am

All times are UTC + 3 hours


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue May 29, 2018 2:45 pm 

Joined: Wed May 23, 2018 9:48 am
Posts: 14
В чем может быть
Code:
long GetLocalUTC()
{
//Insert the code starting here
   time_t utc;
   struct tm utc_tm, local_tm;
   utc = time(&utc);//freeze on this func call
   //MessageBox(NULL,"3","",MB_OK);
   memcpy(&utc_tm, gmtime(&utc), sizeof(struct tm));
   memcpy(&local_tm, localtime(&utc), sizeof(struct tm));
   utc = utc + ((local_tm.tm_hour - utc_tm.tm_hour) * 3600);
   return utc;
}

проблема ?


Top
 Profile  
 
PostPosted: Wed May 30, 2018 6:11 am 

Joined: Fri Feb 24, 2012 11:28 am
Posts: 127
Можно попробовать
Code:
utc = time(NULL);

или просто
Code:
time(&utc);


Top
 Profile  
 
PostPosted: Wed May 30, 2018 9:01 am 

Joined: Wed May 23, 2018 9:48 am
Posts: 14
Понятия неимею где тяпка берет реализацию этой ф-ции, но оно тупо не рабочее и виснет как не крути.Потому пришлось дергать её на прямую из msCRT
Code:
#pragma code ("msvcrt40.dll")
time_t time(time_t *timer);
#pragma code()


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by International PLCforum® Forum Software © PLCforum
Mobile version