In Windows, getlocaltime () and getsystemtime () are obtained at different times.

Source: Internet
Author: User
Tags local time
# Include <iostream. h> // # include <WINBASE. h> # include <windows. h> // # pragma comment (Lib, "kernel32.lib") // using namespace STD; void main () {systemtime required IME; getlocaltime (& systime ); // cout <"today is:"; cout <policime. wyear <"year" <required ime. wmonth <"month" <symbol ime. wday <"day" <Endl; cout <"the current time is:"; cout <policime. whour <":" <policime. wminute <":" <policime. wsecond <":" <policime. wmilliseconds <Endl; cout <"" <systime. W Dayofweek <Endl; cout <Endl; getsystemtime (& systime); // system time cout <"current time:"; cout <systime. whour <":" <policime. wminute <":" <policime. wsecond <":" <policime. wmilliseconds <Endl; cout <Endl;} getsystemtime: The returned value is UTC. coordinated Universal Time (UTC) is defined and recommended by the International Radio advisory board, the time scale maintained by the international time Bureau (BiH) in units of international unit system (SI) seconds. For most practical applications related to Radio Rules, the Coordinated Universal Time (UTC) is equivalent to the average solar time on the primary Meridian (longitude 0. In the past, the Greenwich Mean Time (GMT) was used. Coordinated Universal Time is represented by a 24-hour clock, but can also be converted to a 12-hour clock (AM and PM ). UTC is used for flight and navigation. It is also called Zulu. UTC uses the Gregorian calendar ------------------------------ getlocaltime: The returned local time. I recommend that you use this time as the time void getsystemtime (lpsystemtime // system time ); void getlocaltime (lpsystemtime // system time); typedef struct _ systemtime {word wyear; Word wmonth; Word wdayofweek; Word wday; Word whour; Word wminute; Word wsecond; word wmilliseconds;} systemtime, * psystemtime; systemtime interval m; getsystemtime (& interval m );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.