linux C++ 獲取當前時間,以標準時間「年-月-日 時:分:秒」的形式輸出,且秒後邊跟小數精確到毫秒

struct timeval tv; char buf[64]; gettimeofday(&tv, NULL); strftime(buf, sizeof(buf)-1, "%Y-%m-%d %H:%M:%S", localtime(&tv.tv_sec)); fprintf(stderr, "%s.%03d: ", buf, (int)(tv.tv_usec
相關文章
相關標籤/搜索