Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: epoch reduction

by fullermd (Priest)
on Apr 20, 2012 at 06:39 UTC ( #966103=note: print w/ replies, xml ) Need Help??


in reply to epoch reduction

Assuming that by 'epoch time' you mean time_t, you don't need to convert to some other form. Since time_t is a lying liar and pretends every day is exactly 86400 seconds long, you can just do some /'s and %'s to find which fit in the same day and the highest for the day.

(of course, because of the undefined behavior around leap seconds, you can't really be sure whether % 86_400 == 0 is actually 00:00:00 or 23:59:60, but I think most systems repeat the 86399th instead. And since you can't tell anyway, it probably doesn't matter)


Comment on Re: epoch reduction
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://966103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2015-07-03 00:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls