-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Description
The change looks fine, but it strikes me as odd for us to re-use `wallclock()` which is implemented in fread.c:
Lines 379 to 392 in e73c2c8
| double wallclock(void) | |
| { | |
| double ans = 0; | |
| #ifdef HAS_CLOCK_REALTIME | |
| struct timespec tp; | |
| if (0==clock_gettime(CLOCK_REALTIME, &tp)) | |
| ans = (double) tp.tv_sec + 1e-9 * (double) tp.tv_nsec; | |
| #else | |
| struct timeval tv; | |
| if (0==gettimeofday(&tv, NULL)) | |
| ans = (double) tv.tv_sec + 1e-6 * (double) tv.tv_usec; | |
| #endif | |
| return ans; | |
| } |
I typically think of fread.c as a separate library, since its code is also used by pydatatable. OTOH, the function is declared in data.table.h, not fread.h, and we also have calls to wallclock() in other C files, e.g. fsort() and gsumm(). So maybe it's fine.
Originally posted by @MichaelChirico in #6296 (comment)
It's not clear if wallclock() needs to live in fread.c; it's certainly more appropriate for the implementation to be in utils.c, spiritually.
Reactions are currently unavailable