Game Development Community

dev|Pro Game Development Curriculum

get Unix Timestamp

by Nick Matthews · 12/31/2007 (2:31 pm) · 0 comments

Open main.cc and underneath all the includes, add this:
#include "stdio.h"
#include "time.h"

Then around line 200 in the same file, after the getRealTime ConsoleFunction:
ConsoleFunction( getUnixTimestamp, S32, 1, 1, "Used to get a UNIX Timestamp (Seconds since Jan 01, 1970)")
{
	time_t seconds;
	seconds = time (NULL);

	return seconds;
}

And can be called using getUnixTimestamp();