### utils.time( world ) function Returns the timeofday (in minecraft ticks) for the given world. This function is necessary because canarymod and bukkit differ in how the timeofday is calculated. See http://minecraft.gamepedia.com/Day-night_cycle#Conversions
(world)
| 461 | |
| 462 | ***/ |
| 463 | function getTime(world) { |
| 464 | world = _world(world); |
| 465 | |
| 466 | if (__plugin.bukkit) { |
| 467 | return world.time; |
| 468 | } |
| 469 | if (__plugin.canary) { |
| 470 | // there's a bug in canary where if you call world.setTime() the world.totalTime |
| 471 | // becomes huge. |
| 472 | if (world.totalTime < world.rawTime) { |
| 473 | return world.totalTime; |
| 474 | } else { |
| 475 | return (world.totalTime % world.rawTime + world.relativeTime) % 24000; |
| 476 | } |
| 477 | } |
| 478 | return 0; |
| 479 | } |
| 480 | exports.time = getTime; |
| 481 | |
| 482 | /************************************************************************* |