Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Conversation

@BrettKercher
Copy link
Contributor

file.ts is in seconds, and stats.mtimeMs is in milliseconds. Comparing in milliseconds was not working, since file.ts has less significant digits.
Rounding stats.mtimeMs to seconds instead should fix this.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me considering that you only have milliseconds for one of the timestamps. 👍


Was this helpful? Let us know!

}

if (program.timestampCheck && stats.mtimeMs !== file.ts * 1000) {
if (program.timestampCheck && Math.trunc(stats.mtimeMs / 1000) !== file.ts) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch here, this change makes sense. Nice use of trunc instead of floor as well since this will always be positive, you get a slight performance boost. I assume that this wouldn't be run multiple times per seconds for the same file so we shouldn't need to worry about accidentally caching a changed file in the same second?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.133% when pulling bb868a1 on bugfix/timestamp-fix into 5c662b8 on master.

@stephen-palmer stephen-palmer merged commit 3e132ab into master Jun 6, 2018
@stephen-palmer stephen-palmer deleted the bugfix/timestamp-fix branch December 10, 2018 19:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants