Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Python

Idiom #326 Milliseconds since Unix epoch

Assign to t the number of milliseconds elapsed since 00:00:00 UTC on 1 January 1970.

import time
t = time.time() * 1000

time() returns number of "seconds" as a float (64bit)
#include <chrono>
auto t = std::chrono::milliseconds(std::chrono::system_clock::now().time_since_epoch()).count();

New implementation...
< >
programming-idioms.org