Obtaining Unix timestamps and notes in Delphi (C language time () is calculated at Greenwich Mean time, 8 hours more than in Beijing)

Source: Internet
Author: User
Tags local time

Uses dateutils;
Datetimetounix (now)

It can be converted to Unix time, but it's important to note that it gets more time than time () in C language 8*60*60
This is because now is the time of the current time zone, and the C language is calculated at GMT,
Beijing time is 8 hours more than GMT.
Datetimetounix (now) -8*60*60 is the same as time () in C.

But when I further studied the Datetimetounix function, I found that thetime in Delphi was not translated by any conversion, it was directly read the system time

I tried to change the current computer time zone and found no change to the Delphi return value.

In C + +, when changing the computer time zone, the time () return value changes as well, which means that standard times in C + + are computed by local time and the current time zone .

Therefore, when Delphi is developed, it is important to note that the time stamp obtained by Delphi is the time zone of the current computer, not the standard UTC time.

The Unixtodatetime () function does not convert the time zone, but only transforms it.

http://blog.csdn.net/missmecn/article/details/5870639

Obtaining Unix timestamps and notes in Delphi (C language time () is calculated at Greenwich Mean time, 8 hours more than in Beijing)

Related Article

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.