Jump to content




unix timestamp


  • You cannot reply to this topic
3 replies to this topic

#1 columna1

  • Members
  • 65 posts

Posted 07 April 2014 - 01:11 AM

Is there some webservice or something that I can use to get the current unix timestamp? Im making a program that reads/writes files that use these and I would like it to be at least somewhat accurate.

#2 Anavrins

  • Members
  • 775 posts

Posted 07 April 2014 - 04:25 AM

I use http://www.timeapi.o...now?format=%25s to get the epoch for my programs ;)

Edited by Anavrins, 07 April 2014 - 04:25 AM.


#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 07 April 2014 - 04:39 AM

It seems that you're after something more like a unique value, and since HTML interaction is not always enabled it is better to try and do something local, as such you can do the following.
local function getMinecraftTimestamp()
  return string.format("%d:%d:%d", os.day(), os.time(), os.clock())
end

os.day — Minecraft day
os.time — Minecraft time
os.clock — time in seconds the computer has been running (this may not be the time the program has been running)

#4 columna1

  • Members
  • 65 posts

Posted 07 April 2014 - 04:13 PM

View PostAnavrins, on 07 April 2014 - 04:25 AM, said:

I use http://www.timeapi.o...now?format=%25s to get the epoch for my programs ;)
Thank you very much for this Anavrins this is perfect





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users