开发者

How to access GMT time using VC

开发者 https://www.devze.com 2022-12-24 19:16 出处:网络
In my project i am using GetLocalTime() and GetSystemTime and set the current time into registry. But my problem is when i am changing the开发者_如何学Go time of my machine the changed time only savin

In my project i am using GetLocalTime() and GetSystemTime and set the current time into registry. But my problem is when i am changing the开发者_如何学Go time of my machine the changed time only saving to registry. Is there any chance to access the GMT time so that its independent of machine and nobody can change the time..

Please give some help


How to access GMT time using VC

// you mentioned it
#include <Windows.h>
SYSTEMTIME gmtTime;
ZeroMemory(&gmtTime,sizeof(gmtTime));
GetSystemTime(&gmtTime);

This function is using your machine's hardware time. If you want a time that's independent of your machine, then you may want to use NTP or SNTP

0

精彩评论

暂无评论...
验证码 换一张
取 消