X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fgettime.h;h=44c1590262290546aa5b5dc2a465936856276f3c;hb=457d42c5997cc430231ed221f06d8f4bba2100e7;hp=611906559b5059caf127553cd0f2954d8ea28fe0;hpb=6d0ea26c2d62c3774ff384cf1bfc2a3372b49a3b;p=minetest.git diff --git a/src/gettime.h b/src/gettime.h index 611906559..44c159026 100644 --- a/src/gettime.h +++ b/src/gettime.h @@ -31,7 +31,15 @@ with this program; if not, write to the Free Software Foundation, Inc., Normal build: main.cpp Server build: servermain.cpp */ +enum TimePrecision { + PRECISION_SECONDS = 0, + PRECISION_MILLI, + PRECISION_MICRO, + PRECISION_NANO +}; + extern u32 getTimeMs(); +extern u32 getTime(TimePrecision prec); /* Timestamp stuff @@ -46,8 +54,8 @@ inline std::string getTimestamp() // This is not really thread-safe but it won't break anything // except its own output, so just go with it. struct tm *tm = localtime(&t); - char cs[20]; - strftime(cs, 20, "%H:%M:%S", tm); + char cs[20]; //YYYY-MM-DD HH:MM:SS + '\0' + strftime(cs, 20, "%Y-%m-%d %H:%M:%S", tm); return cs; }