Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shave sub-second precision off modification time #251

Closed
wants to merge 1 commit into from

Conversation

blaenk
Copy link
Contributor

@blaenk blaenk commented May 9, 2014

It seems like System.Directory's getModificationTime is now providing
sub-second precision if it's available in the underlying system call,
which it seems to be for most systems.

The problem is that when the modification time is stored, the DiffTime,
the number of seconds from midnight, has its sub-second precision
shaved off, effectively becoming 0 the next time it's read. When a
file is then checked to see if it has been modified, the file is
always deemed to have been modified because this time still includes
the sub-second precision, which will almost always be later in time
than 0, unless of course it happened to be 0 to begin with.

This simply shaves the sub-second precision off of the time returned by
getModificationTime, and thus no longer rebuilds every single file
each time any one file is saved.

This closes #250

Update: I rebased some extra changes I made and pushed, doubt anyone will be affected. It added back an unrelated newline I removed from a different section of the file, as well as generalized the fix so that it works in both blocks regardless of the version of directory.

It seems like System.Directory's `getModificationTime` is now providing
sub-second precision if it's available in the underlying system call,
which it seems to be for most systems.

The problem is that when the modification time is stored, the DiffTime,
the number of seconds from midnight, has its sub-second precision
shaved off, effectively becoming 0 the next time it's read.  When a
file is then checked to see if it has been modified, the file is
_always_ deemed to have been modified because this time still includes
the sub-second precision, which will almost always be later in time
than 0, unless of course it happened to be 0 to begin with.

This simply shaves the sub-second precision off of the time returned by
`getModificationTime`, and thus no longer rebuilds every single file
each time any one file is saved.

Closes jaspervdj#250
@blaenk
Copy link
Contributor Author

blaenk commented May 9, 2014

The error the Travis CI build ran into is related to this comment. It's unrelated to this fix.

@nagisa
Copy link
Contributor

nagisa commented May 9, 2014

Looks fine, but I wonder whether storing sub seconds when they're available
is viable.
On May 9, 2014 5:43 AM, "Jorge Israel Peña" [email protected]
wrote:

The error the Travis CI build ran into is related to this commenthttps://github.com//issues/250#issuecomment-42262849.
It's unrelated to this fix.


Reply to this email directly or view it on GitHubhttps://github.com//pull/251#issuecomment-42628639
.

@blaenk
Copy link
Contributor Author

blaenk commented May 9, 2014

I think that's a very good idea. I only chose to shave them off because that's what Hakyll was already doing. I'm closing this and submitting a new PR.

@blaenk
Copy link
Contributor Author

blaenk commented May 9, 2014

Re-submitted as PR #252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

./hakyll build always rebuilds everything after switching to GHC 7.8 and Hakyll 4.5.1.0
2 participants