Thank you for reading my thread.

I am experiencing an issue using struct tm and I can't figure out what I am doing wrong. I have looked at several examples and read up on the structure, but to me it all looks right. I would appreciate some fresh eyes on my code and hopefully a resolution. Below is a piece of test code that I wrote in which I receive an error stating I did not set theTime to tm* as in my larger program. By the way my compiler is MINGW if that helps.

Test Code

#include <windows.h>
#include <time.h>
#include <iostream>
using namespace std;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
	time_t seconds;
	struct tm *theTime;
	theTime = localtime(&seconds);
	int aHour = theTime.tm_hour;
	int aMin = theTime.tm_min;
	if(aHour == 1)
		if(aMin == 40)
cout << "Exit";



$ g++ -mwindows "background app.cpp" -o bapp.exe
background app.cpp: In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
background app.cpp:15: error: request for member `tm_hour' in `theTime', which is of non-class type `tm*'
background app.cpp:16: error: request for member `tm_min' in `theTime', which is of non-class type `tm*'

Thank you for reviewing my issue any help is greatly appreciated.

Thank you very much compiled without any errors now I just have to work on some other things.

This question has already been answered. Start a new discussion instead.