Logo

Programming-Idioms

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

Idiom #326 Milliseconds since Unix epoch

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

use Time::HiRes;
$t = Time::HiRes::time * 1000;

See the two notes on time() in the documentation.
#include <chrono>
auto t = std::chrono::milliseconds(std::chrono::system_clock::now().time_since_epoch()).count();

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