You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/03/25 16:08:31 UTC
[mynewt-newt] branch master updated: Truncate sub-seconds from file
modification times
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
The following commit(s) were added to refs/heads/master by this push:
new 9a0b8bd Truncate sub-seconds from file modification times
9a0b8bd is described below
commit 9a0b8bd5765703ad84d1098abb39ffc8406a32af
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri Mar 8 13:38:25 2019 -0800
Truncate sub-seconds from file modification times
This commit addresses a macOS-specific bug.
In macOS sim builds, timestamps of generated files are inconsistent. In
particular, `.a` files are precise to the second, while `.o` files have
nanosecond precision. This is a problem because when a `.a` file is
produced immediately after some `.o` files, it appears that the `.a`
file is actually older than the `.o` files that form it. Consequently,
newt will rearchive the `.a` file on the next build.
This commit does not fix the underlying issue, but it solves the problem
for all intents and purposes. Now, whenever newt reads a modification
time, it truncates its sub-second part.
For more information, see:
https://github.com/apache/mynewt-newt/pull/276
---
newt/toolchain/deps.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/newt/toolchain/deps.go b/newt/toolchain/deps.go
index 2949c4f..48b5462 100644
--- a/newt/toolchain/deps.go
+++ b/newt/toolchain/deps.go
@@ -49,9 +49,13 @@ func NewDepTracker(c *Compiler) DepTracker {
return tracker
}
-func (d *DepTracker) SetMostRecent(name string, time time.Time) {
+func (d *DepTracker) SetMostRecent(name string, t time.Time) {
d.MostRecentName = name
- d.MostRecentTime = time
+
+ // Truncate sub-second part of timestamp. Timestamps of generated files
+ // seems to differ among tools. See
+ // https://github.com/apache/mynewt-newt/pull/276 for details.
+ d.MostRecentTime = time.Unix(t.Unix(), 0)
}
// @return string The name of the dependent file (i.e., the first