Continue refactor

This commit is contained in:
Nathan Fisher 2024-02-12 19:17:00 -05:00
parent d3f4aa04f3
commit 5a640234c3
3 changed files with 4 additions and 4 deletions

View file

@ -146,6 +146,6 @@ void dateTimeFromTimestampParts(int64_t seconds, int64_t nanoseconds, DateTime *
} }
} }
void dateTimeFromTimespec(struct timespec *ts, DateTime *dt) { void dateTimeFromTimespec(DateTime *self, struct timespec *ts) {
dateTimeFromTimestampParts(ts->tv_sec, ts->tv_nsec, dt); dateTimeFromTimestampParts(ts->tv_sec, ts->tv_nsec, self);
} }

View file

@ -148,6 +148,6 @@ void dateTimeGetTimespec (DateTime *self, struct timespec *ts);
Weekday dateTimeGetWeekday (DateTime *self); Weekday dateTimeGetWeekday (DateTime *self);
void dateTimeFromTimestampParts (int64_t seconds, int64_t nanoseconds, void dateTimeFromTimestampParts (int64_t seconds, int64_t nanoseconds,
DateTime *dt); DateTime *dt);
void dateTimeFromTimespec (struct timespec *ts, DateTime *dt); void dateTimeFromTimespec (DateTime *self, struct timespec *ts);
#endif // !LIBEPOCH_H #endif // !LIBEPOCH_H

View file

@ -8,7 +8,7 @@ int main() {
ts.tv_nsec = 42; ts.tv_nsec = 42;
ts.tv_sec = 1706571482; ts.tv_sec = 1706571482;
dateTimeFromTimespec(&ts, &dt); dateTimeFromTimespec(&dt, &ts);
assert(dt.year.year == 2024); assert(dt.year.year == 2024);
assert(dt.month == January); assert(dt.month == January);
assert(dt.day == 29); assert(dt.day == 29);