Getting the time

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Getting the time

by Evergreen » Mon Apr 22, 2013 01:23

How would I go about getting what time it is in the minetest game? Is there API for it? Furthermore, what does each unit in minetest time relate to in real life?
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Mon Apr 22, 2013 02:06

Use minetest.env:get_timeofday()

The number is 0-1 (0=midnight, 0.5=12:00, 0.75=18:00, etc).
See my testclock here for a way to convert to the HH:MM:SS format.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 13 guests

cron