Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: 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!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net