Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


SYSTEMTIME issues

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Oct 01, 2007 7:31 pm    Post subject: SYSTEMTIME issues Reply with quote

Code:
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
        HWND text;
        SYSTEMTIME time;
        char buffer[33], buffer2[33];
        switch(Message) {
    case WM_CREATE:
    SetTimer(hwnd, IDI_TIMER, 1000, (TIMERPROC) NULL); //create timer

        text = CreateWindowEx(0,
        "STATIC", "",
        WS_CHILD|WS_VISIBLE, 0,0,100,20,
        hwnd,(HMENU)IDI_STATIC,NULL,0); //create static text

    break;
    case WM_TIMER:
     KillTimer(hwnd, IDI_TIMER);
        GetSystemTime(&time);
        wsprintf(buffer2, "%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d", time.wYear,":", time.wMonth,":", time.wDayOfWeek,":", time.wDay
                    ,":",time.wHour,":", time.wMinute,":", time.wSecond,":", time.wMilliseconds);
        wsprintf(buffer, "%d", time.wHour);
        MessageBox(hwnd, buffer2, "asfd", 0);

       // SetDlgItemText(hwnd, IDI_STATIC, &buffer);
    break;
    case WM_CLOSE:
        DestroyWindow(hwnd);
    break;

    case WM_DESTROY:
    KillTimer(hwnd, IDI_TIMER);
        PostQuitMessage(0);
    break;


when i run the program the year is the only thing correct

if i change the date to september 30, the month is still 10. not 9

the hour should be 18 for me right now (9 pm) but its 1
the minutes and down are correct

its just being weird


full source and exe attached



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.


_________________
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Mon Oct 01, 2007 7:54 pm    Post subject: Reply with quote

GetLocalTime
_________________


Last edited by sponge on Mon Oct 01, 2007 7:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Mon Oct 01, 2007 7:54 pm    Post subject: Reply with quote

Its returing the date and time in GMT.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Tue Oct 02, 2007 4:10 am    Post subject: Reply with quote

Flyte wrote:
Its returing the date and time in GMT.

GetSystemTime returns the current time in UTC. As sponge said, you want GetLocalTime to get the fixed time of your system:

Code:
int main()
{
   SYSTEMTIME time;
   GetLocalTime( &time );
   printf( "%02d:%02d:%02d\n", time.wHour, time.wMinute, time.wSecond );
   return 0;
}
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites