1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-10-31 22:36:38 +00:00
Commit graph

1 commit

Author SHA1 Message Date
Aleksa Sarai
d0f7e8cb8b
keywords: correctly handle time keywords
Previously, the time generation code would inexplicably drop parts of
the nanotime -- potentially causing validation to succeed when it should
fail. This was probably do to a bug in the remainder logic, but instead
we should be using .Nanosecond() anyway.

After changing the time of a file with a test case like this:

    // Change the time to something known with nanosec != 0.
    chtime := time.Unix(100, 987654321)
    if err := os.Chtimes("somefile", chtime, chtime); err != nil {
	// panic
    }

timeKeywordFunc() would return the wrong value (time=100.000000021).
This fixes the issue and adds a test case.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-11-01 17:47:06 +11:00