Time () in Linux ()

Source: Internet
Author: User

# Include <time. h>
Time_t time (time_t * calptr)
This is a string of numbers pointed to by the Basic Framework pointer of the time function in milliseconds.

Use the following two functions to convert the Standard Time
# Include <time. h>
Struct TM * gmtime (const time_t * calptr)/* convert it to an international standard time */
Struct TM * localtime (const time_t * calptr)/* convert it to the local time */

The above two functions return a pointer of the TM structure.
The TM structure is as follows:

Struct TM {
Int tm_sec;/* [0, 6] */
Int tm_min;/* [0, 59] */
Int tm_hour;/* [0, 23] */
Int tm_mday;/* [1, 31] */
Int tm_mon;/* [0, 11] */
Int tm_year;/* year since 1900 */
Int tm_wday;/* day since Sunday [0, 6] */
Int tm_yday;/* day cince January 1; [0,365] */
Int tm_isdst;/* Daylight Saving Time flag: <0, 0,> 0 */
}

After obtaining this structure, use the corresponding domain value in the structure to obtain the time.
Note: The year is calculated from 1900, and the corresponding year must be added.

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.