|
alluran Adept
Joined: 14 Sep 2005 Posts: 223 Location: Sydney, Australia
|
Posted: Thu Sep 27, 2007 4:26 pm
Feature Requests |
I almost can't beleive it's not already in there.
%utime() - returns a unix timestamp
%uTimeFormat() - formats a timestamp value
%secs ALMOST does this, but only from the start of the day, we need something that will do seconds since midnight 2000 or 1990 or something (i forget the exact spec)
so we can do a simple %utime(a) - %utime(b) to get the year/month/day/hour/minute/second diff between 2 times, and then %uTimeFormat would allow us to format
that result into whatever we choose (using yyyy/DD/mm/ii/ss etc format) |
|
_________________ The Drake Forestseer |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Sep 27, 2007 5:02 pm |
January 1st 1970 is usually used as the epoch for these things. The world didn't exist before then, or something.
Using time codes is all a bit complex really. There's probably something you can do with CMUD as it stands to get the result you're after.
But if you're really attached to using timecodes, Lua has these exact features, and CMUD 2.x supports Lua out of the box on the command line and in settings. |
|
|
|
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Thu Sep 27, 2007 9:53 pm |
Hmm, I didn't even know about %secs (as it's not in the zMUD Help index). But I still second the request for more time functions. I coded some in zScript for zMUD, e.g. to get the number of seconds since midnight in order to time things:
%eval( (%time( h)*60+%time( n))*60+%time( s))
But it's not terribly efficient! I would rather have a proper timestamp and get seconds and/or milliseconds since Jan 01 1970 (which is what a unix timestamp is).
Actually I coded my own function in zMUD to do exactly this but it involves a lot of multiplication, addition and %time()s! |
|
|
|
|
|