void sprint_now() { char buf[100]; const time_t now = time(NULL); _snprintf(buf, sizeof(buf), "time=%I64d seconds", now); }
Programming Tips - MSVC: How to deal with time_t in an _snprintf() ?
Date: 2010mar23
Update: 2025oct23
Language: C/C++
Platform: Windows
Keywords: 64, i64, bit, print, printf, snprintf, fprintf
Q. MSVC: How to deal with time_t in an _snprintf() ?
A. As of Visual Studio 2005, it is signed 64 bits so do: