揮発性のメモ2

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

ore_ctime

#include <stdio.h>
#include <unistd.h>
#include <time.h>

const char *ore_ctime( time_t t )
{
    static char s[256];

    if( t==0 ) t=time(NULL);
    struct tm *tmp = localtime(&t);
    strftime( s, sizeof(s), "%Y-%m-%d %H:%M:%S", tmp );
    return s;
}

int main(int argc, char **argv)
{
    for(;;){
        sleep(1);
        fprintf(stderr,"hogehoge-%s\n",ore_ctime(0));
    }
}