To supplement that part of David Carlisle's answer which uses the POSIX date
utility, here is a way to get the epoch on Windows.
On Windows the "epoch time" concept not only implemented in Unix-like environments and their utilities, but also in the standard C library functions implemented in the Microsoft Visual C Library.
That is to say, Microsoft's <time.h>
material is based on a Unix-like time_t
whose units are seconds, and which measures since the Epoch. This is not required by ISO C, but it helps port code which assumes that representation.
So you can make yourself some trimmed down epoch.exe
with Visual C that prints the time.
I just compiled this code with VS2008 into a Win32 console application.
#include <stdio.h>
#include <time.h>
int main(void)
{
printf("%ld\n", (long) time(0));
return 0;
}
The statically-linked (no dependency on a msvcrt.dll
) executable (156 kB) is here.