Skip to content

Instantly share code, notes, and snippets.

@fenollp
Created October 24, 2013 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fenollp/7137764 to your computer and use it in GitHub Desktop.
Save fenollp/7137764 to your computer and use it in GitHub Desktop.
Get an easily comparable version number of Erlang/OTP at runtime.
otp_vsn () ->
R = fun (D, U) -> 10 * (D - $0) + U - $0 end,
case erlang:system_info(otp_release) of
[$R, D,U ] -> R(D,U) + 0.00;
[$R, D,U, $A ] -> R(D,U) + 0.01;
[$R, D,U, $B ] -> R(D,U) + 0.02;
[$R, D,U, $B, DD,UU] -> R(D,U) + R(DD,UU) / 10 + 0.00
end.
%% On R16B02: otp_vsn() = 16.2
%% On R16A : otp_vsn() = 16.01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment