📄 29a-7.031
字号:
Virus Times
-----------
In the beginning viruses used time triggered events based in local
time, but today the World Wide Web has spread over the entire planet and
worms infects computers in many different time zones, so relying in the
current system time for global syncronized events is incorrect.
Correctly time measuring can lead to very effective DDOS attacks,
causing panic at earth level, like that root nameserver query flood that
stopped big part of the internet for some hours.
There are many types of time servers on the internet, the most used
protocol is the SNTP (Simple Network Time Protocol).
So i had coded two functions to easy handle SNTP:
DWORD __stdcall sntp_getftime(char *szIpAddr, FILETIME *ft);
DWORD __stdcall sntp_getstime(char *szIpAddr, SYSTEMTIME *st);
where:
szIpAddr = pointer to string containing an IP four dotted address.
ft = pointer to FILETIME structure that will receive the UTC time.
st = pointer to SYSTEMTIME structure that will receive the UTC time.
returns: 0 on success.
These functions will get the UTC time from the server and convert it
to the specified Win32 structure. You can convert UTC time to local time
using common Win32 time management functions upon these structures.
***
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -