Results 1 to 3 of 3

Thread: [RESOLVED] Question about Time

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Resolved [RESOLVED] Question about Time

    I got a question, how to make the time to be every 12 hours
    main.cpp
    Code:
    _beginthread(ReloadMyOption,0,NULL);
    Code:
    void ReloadMyOption(void * lpParam)
    {
    	int Time = GetPrivateProfileInt("Help","TimeReload",1,AutoMsg);
    	Sleep(Time * 60000);
    
    	AutoRemoveLuke();
    
    	_endthread;
    }

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Re: Question about Time

    if im correct: 1* 3600000 = 1 hour
    12 * 3600000 = 12 hours right?

  3. #3
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    679

    Re: Question about Time

    Sleep() takes an argument of milliseconds

    1000 millseconds is 1 sec
    60 secs is 1 minute
    60 mins is 1 hour

    so 12 hours = 1000 * 60 * 60 * 12 = 3600000 * 12 milliseconds
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++17 Compiler: Microsoft VS2019 (16.7.4)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width