Skip to content

Commit

Permalink
Make the BUILD_TIMESTAMP build info entry contain the number of secon…
Browse files Browse the repository at this point in the history
…ds (instead of milliseconds) since the epoch.

This fixes the build stamp data in Bazel itself and is also consistent with what we do internally at Google.

Fixes #4469 .
RELNOTES[INC]: BUILD_TIMESTAMP now contains seconds (and not milliseconds) since the epoch.

PiperOrigin-RevId: 191418132
  • Loading branch information
lberki authored and Copybara-Service committed Apr 3, 2018
1 parent d92db2d commit e52c841
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class BuildInfo {
public static final String BUILD_HOST = "BUILD_HOST";

/**
* Build time as milliseconds since epoch
* Build time as seconds since epoch
*/
public static final String BUILD_TIMESTAMP = "BUILD_TIMESTAMP";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public ActionResult execute(ActionExecutionContext actionExecutionContext)
stableMap.put(BuildInfo.BUILD_EMBED_LABEL, options.embedLabel);
stableMap.put(BuildInfo.BUILD_HOST, hostname);
stableMap.put(BuildInfo.BUILD_USER, username);
volatileMap.put(BuildInfo.BUILD_TIMESTAMP, Long.toString(getCurrentTimeMillis()));
volatileMap.put(BuildInfo.BUILD_TIMESTAMP, Long.toString(getCurrentTimeMillis() / 1000));

Map<String, String> overallMap = new TreeMap<>();
overallMap.putAll(volatileMap);
Expand Down

0 comments on commit e52c841

Please sign in to comment.