Logo

Programming-Idioms

  • Go

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.Now().UnixMilli()
#include <chrono>
auto t = std::chrono::milliseconds(std::chrono::system_clock::now().time_since_epoch()).count();

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