Go Down

Topic: Time Program (Read 2047 times) previous topic - next topic

Chaul

Unless I misunderstood something, I would just take the elapsed time with millis(), multiply that by some factor, and convert that count into hh:mi:ss form. Take a modulo of the count with day length in milliseconds if not interested in passed days since last restart, or you could reset the local variable after each day. It would work for a month or so and then you would have to take the rollover into account to make it work longer. You could poll the current time as many times as you want or whenever needed and it would be accurate without a need for separate struct to hold counters separately for hh, mi and ss.

Docedison

Whatever your calculations are is of no relevance, it is the accuracy of the Arduino clock (the resonator or crystal) that is the limiting factor and the reason I pointed you to the other discussion. Time is a frequent discussion here. I mentioned the other methods simply because the change in frequency of the primary clock (again resonator or..) is such a small amount that it might just be close enough to simply do a small 'correction' to either the code or to the time source which is still the crystal or resonator. In addition I mentioned that the methods have flaws that make them unusable for more than trivial observation, certainly not to do more than generate conversation or as a proof of concept.

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

daremick


Unless I misunderstood something, I would just take the elapsed time with millis(), multiply that by some factor, and convert that count into hh:mi:ss form. Take a modulo of the count with day length in milliseconds if not interested in passed days since last restart, or you could reset the local variable after each day. It would work for a month or so and then you would have to take the rollover into account to make it work longer. You could poll the current time as many times as you want or whenever needed and it would be accurate without a need for separate struct to hold counters separately for hh, mi and ss.


You got it Chaul :) . This code, or at least the one I'm working on will reset every day and start fresh, no need to stay accurate for 68 years, It will be new every day.

for everyone
If anyone has looked into the two links I gave at the top you can clearly see that not even NASA and JPL have a "set" timezone. In fact the only time zones on Mars are relative to the rovers and their landers. Unless you count the Airy-0 crater (Airy Mean Time) and that hasn't been accepted as the official or accurate basis either ( research Mars Time ----  http://en.wikipedia.org/wiki/Timekeeping_on_Mars ---)

The idea here, as is with the case even with NASA, JPL, etc, is to just get essentially a "counter" that starts at 00.00.00 and ends on 24.39.35. Resetting every day at 00.00.00. There is no Mean time to base the 24ish hour day anyway so you'd be just as accurate to start the clock as soon as the light of the sun hits your boots and as long as it hits 24.39.35 when the dark hits them, I've made my goal.

On a hugely positive note I am so glad to see a lot of response on this post I had tried repeatedly to get some energy going on this in the past and on other forums and, well, it was a flop. I do appreciate every ounce of information you guys ( and gals?) are leaving here and I am taking every point of view into consideration. I'm not one to just be whiny and argue that I don't like your ideas. You wouldn't take the time to post here if you didn't have a valid point and I respect that and give your word weight. So again Thanks to all who are participating here :) I appreciate everyone's input.

Chaul

I don't know how Mars time works, but I figured now that it would make sense that 1s is just as long on Mars as it is on Earth. It's just that Mars takes a little longer to revolve. So, if you start the clocks at the same time, lets say midnight on Earth. It would show the same time 23:59:59 at the end of the day. On earth, it would reset back 00:00:00 on the next second, but on Mars, it would continue to 24:00:00 and so on. When the Mars clock resets to zero, it would be 00:39:35 on Earth clock. On the next Mars midnight, it would be 01:30 or so on Earth. I'm confused again but never mind that..

daremick


I don't know how Mars time works, but I figured now that it would make sense that 1s is just as long on Mars as it is on Earth. It's just that Mars takes a little longer to revolve. So, if you start the clocks at the same time, lets say midnight on Earth. It would show the same time 23:59:59 at the end of the day. On earth, it would reset back 00:00:00 on the next second, but on Mars, it would continue to 24:00:00 and so on. When the Mars clock resets to zero, it would be 00:39:35 on Earth clock. On the next Mars midnight, it would be 01:30 or so on Earth. I'm confused again but never mind that..


The difference in time between seconds on Mars and Earth is (Earth 1.0274912510416665 second = Mars 1 second)  :)

AWOL

Quote
The difference in time between seconds on Mars and Earth i

How can an SI constant not be constant (except in cases of extreme relativistic effects)?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Chaul


The difference in time between seconds on Mars and Earth is (Earth 1.0274912510416665 second = Mars 1 second)  :)

Are you talking about theory of relativity or something, since I'm still kinda lost on what that notion means. I guess I should walk away from this topic slowly before further embarassment...

daremick

#22
Jan 08, 2013, 12:50 am Last Edit: Jan 08, 2013, 12:54 am by daremick Reason: 1

Quote
The difference in time between seconds on Mars and Earth i

How can an SI constant not be constant (except in cases of extreme relativistic effects)?



???? What exactly are you asking? SI stands for the international system of units, and nowhere in this topic has it been implied that they aren't constant. In fact the only mention of SI at all is in your post, while simultaneously questioning, I guess, your own post? The reference to the difference in time on Mars and Earth has nothing to do with SI units. One Second will always be one second. The post you quoted (all though you did not quote it entirely) stated;

The difference in time between seconds on Mars and Earth is (Earth 1.0274912510416665 second = Mars 1 second)

Meaning that it takes 1.027 seconds (roughly) for a rotation on earth that would take "1 second" on mars. Mars has a different rotation and orbit than earth does, the same goes with every other planet in the solar system. In order to measure time in the first place early clocks (sundials) were derived that measured when the sun made a shadow on one mark on the dial and when it made a complete circle around to the mark again. This is called a "day", "solar day", or as we know it 24hours. However the earth does not make a complete revolution exactly every 24 hours it is closer to 23hours 56minutes and 4seconds give or take :P so in order to measure a "day" on other planets we measure how long it takes that planet to complete one rotation. For example mercury's "day" lasts about 176 Earth days "solar day" and about 58-59 for a siderial day (one rotation). So as you can see our reference of time, the lovely 24hours is not applicable everywhere in the universe, it's just a unit of measure we derived and it splits the day up nicely. Mars happens to have an extremely similar rotational period however it is slightly over by 39minutes and 35seconds.

So to surmise, no one is contesting SI Units, merely explaining that when you take the 24:39:35 mars day and divvy it up into an earth day you go over a second by .027 seconds (roughly) more. over time this fraction of a number adds up and over the course of days, weeks, months, years, you are taking a shower and getting your pajamas on to go to bed on earth whereas on mars you are in rush hour traffic still trying to get home for the wife's meatloaf dinner. I hope that helped to clear some things up for anyone reading this topic. And I hope it helps to clarify why I hope to complete this small project. Thanks for all the feedback, and positive support I see on here. :)

Go Up