23 lines
419 B
C
23 lines
419 B
C
#include "epoch.h"
|
|
#include <assert.h>
|
|
#include <stdint.h>
|
|
#include <time.h>
|
|
|
|
DateTime dt;
|
|
struct timespec ts;
|
|
|
|
int main() {
|
|
dt.zone.tag = UTC;
|
|
yearNew(&dt.year, 2024);
|
|
dt.month = February;
|
|
dt.day = 6;
|
|
dt.hour = 9;
|
|
dt.minute = 28;
|
|
dt.second = 42;
|
|
dt.nanoseconds = 42;
|
|
dateTimeGetTimespec(&dt, &ts);
|
|
assert(ts.tv_sec == 1707211722);
|
|
assert(ts.tv_nsec == 42);
|
|
|
|
return 0;
|
|
}
|