Jump to content
  • Advertisement
Sign in to follow this  
4

Setting The Time

This topic is 4811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do you set the date and time of your system clock using C++ to whatever date and time you want, if possible?

Share this post


Link to post
Share on other sites
Advertisement
You have to use OS-specific calls. You may also need to have the proper privildges (e.g. on windows you need to be an admin to set the clock).

Share this post


Link to post
Share on other sites
Note well that these two functions require special privileges to execute.

Share this post


Link to post
Share on other sites
you can do this in assembler, so your just OS doesnt matter at all (of course you need the privilegs to do this too)

the correct assembler instruction for an x86 : ..... cant remember sorry

(i will search for it in my books a little)

Its Interupt 21h Function 02DH

data looks like this:
AH=02Dh
CH= hours (0-23)
CL= mins (0-59)
DH= secs (0-59)
DL= secs/100 (0-99)

may be useful for some crossplatforming

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!