I have a weird request. I'm making a GPS clock, but I want it to run a few minutes fast, so I can convince people in my household that they need to be on time instead of late. I figured out the time zone hour change, but the minutes are going to be problematic.
Is there a library that can do this kind of work? If so, which one?
CrossRoads:
Why not just add some arbitrary amount to the time you display?
The GPS time zone thing was resolved by a quick bit of math and it never changes anything else besides the hour. I can't do exactly that because I might have a situation of "8:76". Looks a little silly.
There exists an easy shoulder to stand on, an adafruit real time clock library. You don't need the real time clock but you can use the unix time processing routines to add and subtract time. Take a look. The sample code supplied does exactly what you asked for, adding time to current time
I've personally used this function to adjust all the RTC modules (more than a dozen) in a project from local time to GMT by adding 5 hours.
tack:
Just add 'x' to minutes and then do a check to see if you overflowed:-
If mins > 60, take away 60 and add 1 to hours
If hours > 24, take away 24 and add one to the day
Etc
Once you've done that then do whatever you need to do to display your clock.
If you only need time, no date, then it's pretty trivial to just check for overflowing minutes and hours.
What he said.
Except you need to check for >= 60, not just > 60.
It's really just like doing arithmetic using pencil and paper. If you know how you would calculate something using pencil and paper, you can generally have the Arduino do it the same way.