struct timeb example.
ITWeb/개발일반 2013. 2. 13. 16:37Reference URL : http://pubs.opengroup.org/onlinepubs/7908799/xsh/systimeb.h.html
NAME
sys/timeb.h - additional definitions for date and time
SYNOPSIS
#include <sys/timeb.h>
DESCRIPTION
The <sys/timeb.h> header defines the timeb structure that includes at least the following members:time_t time the seconds portion of the current time unsigned short millitm the milliseconds portion of the current time short timezone the local timezone in minutes west of Greenwich short dstflag TRUE if Daylight Savings Time is in effect
The time_t type is defined as described in <sys/types.h>.
The header <sys/timeb.h> declares the following as a function which may also be defined as a macro. Function prototypes must be provided for use with an ISO C compiler.
int ftime(struct timeb *);
APPLICATION USAGE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
ftime(), <time.h>.
[Example Code - timeb.cpp]
#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>
int main () {
timeb tb;
ftime( &tb );
int64_t ts = tb.millitm + (tb.time * 1000);
printf("tb.time*1000 + tb.millitm is %ld", ts);
return 0;
}
[Build]
g++ timeb.cpp -o timeb