Jump to content

Epoch time


Recommended Posts

Hi!

I just ran into the problem of not having a source for the epoch time.

So I decided to try my best and script my own function.

I'm as far as the following:

function getEpochTime()
local nowTime = getRealTime()
 
return ((1900 + nowTime.year) - 1970) * 365.25 * 24 * 60 * 60 + nowTime.month * 30.4167 * 24 * 60 * 60 + nowTime.monthday * 24 * 60 * 60 + nowTime.hour * 60 * 60 + nowTime.minute * 60 + nowTime.second
end

But still, there is something incorrect.

I think it has something to do with the leapyear, but I can't figure it out.

It would be cool if you could help me or even give me a finished function, if there is one.

Thanks in advance!

Madd

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...