21 lines
459 B
C
21 lines
459 B
C
#include "epoch.h"
|
|
#include <assert.h>
|
|
#include <time.h>
|
|
|
|
int main() {
|
|
struct timespec ts;
|
|
DateTime dt;
|
|
|
|
ts.tv_nsec = 42;
|
|
ts.tv_sec = 1706571482;
|
|
dateTimeFromTimespec(&dt, &ts);
|
|
assert(dt.year.year == 2024);
|
|
assert(dt.month == January);
|
|
assert(dt.day == 29);
|
|
assert(dt.hour == 23);
|
|
assert(dt.minute == 38);
|
|
assert(dt.second == 02);
|
|
assert(dt.nanoseconds == 42);
|
|
assert(dt.zone.tag == UTC);
|
|
return 0;
|
|
}
|