Skip to content

Commit a474c1a

Browse files
committed
scientific notation for stat times
1 parent 4e113b9 commit a474c1a

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/node_file.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ using v8::Value;
7171

7272
#define GET_OFFSET(a) ((a)->IsNumber() ? (a)->IntegerValue() : -1)
7373

74-
#define MILLISEC_PER_SEC 1000
75-
#define NANOSEC_PER_MILLISEC 1000000
76-
7774
class FSReqWrap: public ReqWrap<uv_fs_t> {
7875
public:
7976
enum Ownership { COPY, MOVE };
@@ -479,8 +476,8 @@ void FillStatsArray(double* fields, const uv_stat_t* s) {
479476
#endif
480477
// Dates.
481478
#define X(idx, name) \
482-
fields[idx] = (static_cast<double>(s->st_##name.tv_sec) * MILLISEC_PER_SEC) + \
483-
(static_cast<double>(s->st_##name.tv_nsec) / NANOSEC_PER_MILLISEC);\
479+
fields[idx] = (s->st_##name.tv_sec * 1e3) + \
480+
(s->st_##name.tv_nsec / 1e6); \
484481

485482
X(10, atim)
486483
X(11, mtim)

0 commit comments

Comments
 (0)