X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fgettime.h;h=f20728dfdab6628e46905f8f493dec82e3b7a6de;hb=a1868e8f6ca191edc03da342fd7c3088732e1b00;hp=2a6a211b88b3176850a719a486f7d3f3fb1fdb17;hpb=d1ccc64e1ecfd00df36d2b8a8b3420b70434fefd;p=dragonfireclient.git diff --git a/src/gettime.h b/src/gettime.h index 2a6a211b8..f20728dfd 100644 --- a/src/gettime.h +++ b/src/gettime.h @@ -17,47 +17,27 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef GETTIME_HEADER -#define GETTIME_HEADER +#pragma once #include "irrlichttypes.h" +#include +#include -/* - Get a millisecond counter value. - Precision depends on implementation. - Overflows at any value above 10000000. - - Implementation of this is done in: - Normal build: main.cpp - Server build: servermain.cpp -*/ -enum TimePrecision { - PRECISION_SECONDS = 0, +enum TimePrecision +{ + PRECISION_SECONDS, PRECISION_MILLI, PRECISION_MICRO, PRECISION_NANO }; -extern u32 getTimeMs(); -extern u32 getTime(TimePrecision prec); - -/* - Timestamp stuff -*/ - -#include -#include - inline std::string getTimestamp() { time_t t = time(NULL); // 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; } - - -#endif