'timeb'에 해당되는 글 1건

  1. 2013.02.13 struct timeb example.

struct timeb example.

ITWeb/개발일반 2013.02.13 16:37

Reference URL : http://pubs.opengroup.org/onlinepubs/7908799/xsh/systimeb.h.html


sys/timeb.h - additional definitions for date and time


#include <sys/timeb.h>


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 *);






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;



g++ timeb.cpp -o timeb

크리에이티브 커먼즈 라이선스
Creative Commons License
tags : ,
Trackback 0 : Comment 0

티스토리 툴바