Skip to content

Commit 01fe5a0

Browse files
author
Rob Richards
committed
MFH: use macro - llabs not always available on win32
1 parent 06877d0 commit 01fe5a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ext/date/lib/timelib.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
m = NULL; \
2929
} \
3030

31+
#if defined(_MSC_VER)
32+
#define TIMELIB_LLABS(y) y < 0 ? (y * -1) : y
33+
#else
34+
#define TIMELIB_LLABS(y) llabs(y)
35+
#endif
36+
3137
timelib_time* timelib_time_ctor()
3238
{
3339
timelib_time *t;
@@ -168,7 +174,7 @@ void timelib_dump_date(timelib_time *d, int options)
168174
printf("TYPE: %d ", d->zone_type);
169175
}
170176
printf("TS: %lld | %s%04lld-%02lld-%02lld %02lld:%02lld:%02lld",
171-
d->sse, d->y < 0 ? "-" : "", llabs(d->y), d->m, d->d, d->h, d->i, d->s);
177+
d->sse, d->y < 0 ? "-" : "", TIMELIB_LLABS(d->y), d->m, d->d, d->h, d->i, d->s);
172178
if (d->f > +0.0) {
173179
printf(" %.5f", d->f);
174180
}

0 commit comments

Comments
 (0)