Skip to content

Commit 3e5afc1

Browse files
committed
test - use tounixtimestamp instead of floor
1 parent a474c1a commit 3e5afc1

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/node_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void FillStatsArray(double* fields, const uv_stat_t* s) {
475475
fields[9] = -1;
476476
#endif
477477
// Dates.
478-
#define X(idx, name) \
478+
#define X(idx, name) \
479479
fields[idx] = (s->st_##name.tv_sec * 1e3) + \
480480
(s->st_##name.tv_nsec / 1e6); \
481481

test/parallel/test-fs-utimes.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ function stat_resource(resource) {
4040

4141
function check_mtime(resource, mtime) {
4242
const stats = stat_resource(resource);
43+
mtime = fs._toUnixTimestamp(mtime);
44+
const real_mtime = fs._toUnixTimestamp(stats.mtime);
4345
if (common.isWindows) {
4446
// check ms precision on windows.
45-
return Math.floor(mtime) === Math.floor(stats.mtime);
47+
return mtime === real_mtime;
4648
} else {
47-
mtime = fs._toUnixTimestamp(mtime);
48-
const real_mtime = fs._toUnixTimestamp(stats.mtime);
49-
5049
// check up to single-second precision
5150
// sub-second precision is OS and fs dependant
5251
return mtime - real_mtime < 2;

0 commit comments

Comments
 (0)