'Timestamp'에 해당되는 글 2건

  1. 2013.02.13 struct timeb example.
  2. 2011.11.30 JavaScript unix timestamp 맛보기.

struct timeb example.

ITWeb/개발일반 2013.02.13 16:37

Reference 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


신고

'ITWeb > 개발일반' 카테고리의 다른 글

C++ nano time  (0) 2013.03.12
TFIDF  (0) 2013.02.19
struct timeb example.  (0) 2013.02.13
convert int to string in c++  (0) 2013.02.13
caution using zlib & cryptopp  (0) 2013.02.12
check qmail & dovecot version.  (0) 2013.02.05
tags : timeb, Timestamp
Trackback 0 : Comment 0

JavaScript unix timestamp 맛보기.

ITWeb/개발일반 2011.11.30 15:08
아래 두개 중에 택 1 하세요.
둘다 정수를 return 해 줍니다.
다만, 차이는 아시죠.. 반올림과 내림이라는거..

[참고사이트]
http://www.w3schools.com/jsref/jsref_obj_math.asp

[CASE 1]
Math.round((new Date()).getTime() / 1000);

[CASE2]
Math.floor((new Date()).getTime() / 1000);

 
신고

'ITWeb > 개발일반' 카테고리의 다른 글

JSCoverage 사용 팁.  (0) 2011.12.05
Cookie 랑 Web Storage 맛보기.  (0) 2011.12.01
JavaScript unix timestamp 맛보기.  (0) 2011.11.30
JavaScript Cookie 맛보기.  (0) 2011.11.30
Mobile Device API 관련 PDF  (0) 2011.11.30
COMET 언제쩍 건데.. 그래서 맛보기  (0) 2011.11.30
tags : Timestamp
Trackback 0 : Comment 0