ID:195093
 
//  Title: Greenwich Mean Time
// Credit to: Hiead
// Contributed by: Hiead


/*
How useful would it be to be able to simply grab the current
time according to GMT? Wouldn't it be nice if we could simplify
time communications when a player-base often consists of people
from around the world? Greenwich Mean Time is a very common
choice for internationalization, and can be very useful when
discussing the time with others not in your time zone.

The gmTime() function takes a format string as its sole
argument. This format string is the same as would be passed
to the time2text() function. I haven't tested this with
clocks that are not on-the-mark, but I can imagine that to
get a correct read from the function, it helps to have a
correctly set system clock.
*/


proc
gmTime(string = "hh:mm:ss")
var/add = (round(world.timeofday/36000) % 60) \
- text2num(time2text(world.timeofday, "hh"))

return time2text(world.timeofday + add*36000, string)

///*
// Testing Code/Sample Implementation:

client/verb/Time()
src << "Current time: [time2text(world.timeofday, "hh:mm:ss")]"
src << "Greenwich Mean Time: [gmTime("hh:mm:ss")]"

//*/


Hiead