I need to get the time in GMT, so I used this:
Code:
#include <iostream>
#include <windows.h>
#include <string>
#include <time.h>
using namespace std;
int main()
{
time_t now;
struct tm *tm_now;
struct tm *tm_gmt;
char buff[BUFSIZ];
now = time ( NULL );
tm_now = gmtime(&now);
strftime ( buff, sizeof buff, "%a, %d %b %Y %H:%M:%S %Z", tm_now );
printf ( "%s\n%s\n", buff );
return 0;
}
This code is straight from the FAQ, and it said to use gmtime() to get the time as GMT. But when I run that code, I get it in australian standard time. Does anyone know what went wrong, or an alternative way to get the time as GMT?