Fumofumotris/source/game/gametime.c

20 lines
333 B
C
Raw Normal View History

2024-04-22 22:13:13 +00:00
#include "gametime.h"
2024-03-25 05:34:59 +00:00
#include <time.h>
2024-04-22 22:13:13 +00:00
#define ONE_E_9 1000000000
2024-03-25 05:34:59 +00:00
2024-04-22 22:13:13 +00:00
Time TimeNow()
2024-03-25 05:34:59 +00:00
{
struct timespec ts;
timespec_get(&ts, TIME_UTC);
2024-04-22 22:13:13 +00:00
return ts.tv_nsec + ts.tv_sec * ONE_E_9;
2024-03-25 05:34:59 +00:00
}
2024-04-22 22:13:13 +00:00
double TimeNowD()
2024-03-25 05:34:59 +00:00
{
2024-04-16 22:14:53 +00:00
struct timespec ts;
timespec_get(&ts, TIME_UTC);
return ts.tv_sec + (double)ts.tv_nsec / 1000000000.0;
2024-03-25 05:34:59 +00:00
}