揮発性のメモ2

http://d.hatena.ne.jp/iww/

2016-10-12から1日間の記事一覧

clock_gettime の使い方

C

Man page of CLOCK_GETRES #include <stdio.h> #include <time.h> char *getnow() { static char buf[32]; struct timespec t; struct tm tm; clock_gettime(CLOCK_REALTIME, &t); localtime_r(&t.tv_sec, &tm); strftime(buf, 32, "%Y-%m-%d %H:%M:%S.", &tm); sprintf(buf+2</time.h></stdio.h>…