diff options
author | Björn Gustavsson <[email protected]> | 2016-04-18 12:17:09 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-04-25 08:28:26 +0200 |
commit | 6aeb1b0ace48ef49af6fd3f2feef614e3d68aa58 (patch) | |
tree | 6b4e2a6d8a371d00259fc7dcb4b44c954aaf21bb /lib/compiler | |
parent | ec828d3981e59e746a58977034d1020be3ff8915 (diff) | |
download | otp-6aeb1b0ace48ef49af6fd3f2feef614e3d68aa58.tar.gz otp-6aeb1b0ace48ef49af6fd3f2feef614e3d68aa58.tar.bz2 otp-6aeb1b0ace48ef49af6fd3f2feef614e3d68aa58.zip |
Remove timestamps from BEAM files
As long as anyone can remember, the compilation time has been included
in BEAM files (and can be retrieved using Mod:module_info(compile)).
The timestamp has caused problems for anyone using tools such as 'cmp'
to compare BEAM files or for package managers:
http://erlang.org/pipermail/erlang-questions/2016-April/088717.html
Rarely has the timestamp been of any use. Yes, sometimes the timestamp
could help to figuring out which version of a module was used, but
nowadays a better way is to use Mod:module_info(md5).
To get rid of this problem, remove the timestamp from BEAM files in
OTP 19. Don't add an option to include timestamps.
Utilities that depend on the timestamp will need to be modified.
For example:
http://erlang.org/pipermail/erlang-questions/2016-April/088730.html
Instead of using the compilation time, the MD5 for the BEAM code can
be used. Example:
1> c:module_info(md5).
<<79,26,188,243,168,60,58,45,34,69,19,222,138,190,214,118>>
2> beam_lib:md5(code:which(c)).
{ok,{c,<<79,26,188,243,168,60,58,45,34,69,19,222,138,190,214,118>>}}
3>
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/beam_asm.erl | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/compiler/src/beam_asm.erl b/lib/compiler/src/beam_asm.erl index 9a81537006..f6ca7a0afb 100644 --- a/lib/compiler/src/beam_asm.erl +++ b/lib/compiler/src/beam_asm.erl @@ -230,9 +230,7 @@ build_attributes(Opts, SourceFile, Attr, MD5) -> [_|_] -> [{source,SourceFile}] end, Misc = case member(slim, Opts) of - false -> - {{Y,Mo,D},{H,Mi,S}} = erlang:universaltime(), - [{time,{Y,Mo,D,H,Mi,S}}|Misc0]; + false -> Misc0; true -> [] end, Compile = [{options,Opts},{version,?COMPILER_VSN}|Misc], |