Time Type
Coordinated Universal time (UTC): world standard times, i.e. GMT (Greenwich Mean, GMT).
Calendar time: The time that is represented by a standard point in time (January 1, 1970 0 o'clock) to the number of seconds elapsed.
#include <stdio.h>#include<time.h>#include<sys/time.h>voidMain () {//Get calendar Timetime_t CTime; Time (&CTime); printf ("CTime is%d\n", CTime); //Get microsecond time structTimeval Mtime; Gettimeofday (&Mtime, NULL); printf ("Mtime is%d.%d\n", Mtime.tv_sec, mtime.tv_usec); //Get Standard Time structTM *Gtime; Gtime= Gmtime (&CTime); printf ("Gtime is%02d:%02d\n", Gtime->tm_hour, gtime->tm_min); //Get local time structTM *Ltime; Ltime= LocalTime (&CTime); printf ("Ltime is%02d:%02d\n", Ltime->tm_hour, ltime->tm_min); //Convert time Format Char*Atime; Atime=asctime (ltime); printf ("Atime is%s\n", atime);}
[Country EMBED strategy] [077] [Linux time programming]