19YarprunCheckpoints::YarprunCheckpoints()
24 time_t
now=time(
nullptr);
26 sprintf(path,
"C:/Users/user/Documents/yarprun_log/yarprun_log_%d_%s_%u.txt", GetCurrentProcessId(), ctime(&now), (
unsigned)rand());
29 gettimeofday(&now,
nullptr);
30 sprintf(path,
"/tmp/yarprun_log_%d_%s_%06d.txt",
getpid(), ctime(&(
now.tv_sec)), (
int)
now.tv_usec);
33 for (
int t=10;
t<256 && path[
t]; ++
t)
35 if (path[
t] ==
'\n' || path[
t] ==
'\r' || path[
t] ==
' ' || path[
t] ==
':' || path[
t] ==
'?') {
40 mLogFile=fopen(path,
"w");
67 fprintf(mLogFile,
"%s: file %s function %s line %d\n", prefix, sFile, sFunction, line);
static YarprunCheckpoints & instance()
void checkpoint(const char *prefix, const char *sFile, const char *sFunction, int line)
double now()
Return the current time in seconds, relative to an arbitrary starting point.
int getpid()
Portable wrapper for the getppid() function.