I need help with manipulating my computers clock through a c++ program and i have no idea on how to make the program. Does anyone have any idea on how to do this?
spuddy1515 0 Newbie Poster
Recommended Answers
Jump to PostWhat kind of manipulation are you looking for? Standard C++ pretty much only gives you query capabilities for the clock, though you have comprehensive time and date control.
Jump to PostTo what end? You can easily call std::clock() to get the current value and perform math on it. But the result may not be meaningful.
Jump to PostThat's slightly harder, but you have more control and it's actually portable:
#include <ctime> #include <iostream> int main() { std::time_t now = std::time ( 0 ); std::tm *local = std::localtime ( &now ); local->tm_hour -= 6; std::time_t before = std::mktime ( local ); std::cout<<"Now: "<< ctime ( …
Jump to Post>While I'm no expert at C++ I think I can help you with your dilema.
I don't think you can, sorry.>I use the library time.h so you'd want to add
time.h is deprecated in standard C++. New code should be written using the ctime header instead.>this …
All 16 Replies
Narue 5,707 Bad Cop Team Colleague
spuddy1515 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
spuddy1515 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
spuddy1515 0 Newbie Poster
Merkwurdigliebe 0 Newbie Poster
Sky Diploma 571 Practically a Posting Shark
Narue 5,707 Bad Cop Team Colleague
spuddy1515 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
spuddy1515 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
spuddy1515 0 Newbie Poster
Salem 5,265 Posting Sage
spuddy1515 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.