This works on Ubuntu Linux:
#include <sys/time.h>
...
struct timeval tv;
gettimeofday(&tv, NULL);
unsigned long long millisecondsSinceEpoch =
(unsigned long long)(tv.tv_sec) * 1000 +
(unsigned long long)(tv.tv_usec) / 1000;
printf("%llu
", millisecondsSinceEpoch);
At the time of this writing, the printf() above is giving me 1338850197035. You can do a sanity check at the TimestampConvert.com website where you can enter the value to get back the equivalent human-readable time (albeit without millisecond precision).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…