Created
June 10, 2014 00:26
-
-
Save eiri/74f7c9a107d7eb858df7 to your computer and use it in GitHub Desktop.
erlang:now() to unix timestamp and back
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
now_to_timestamp() -> | |
now_to_timestamp(erlang:now()). | |
now_to_timestamp({Mega, Sec, _}) -> | |
Mega * 1000000 + Sec. | |
timestamp_to_now(TS) -> | |
{TS div 1000000, TS rem 1000000, 0}. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment