-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|97|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Timing


 
Jayenkai
Created : 17 January 2010
 
Language : Blitz Max

Timestamp



Why doesn't BlitzMax have a timestamp?!

This oughta work for most stuff.. Doesn't keep mills, but they're addable if you're bored.


 

Comments


Sunday, 17 January 2010, 10:54
Afr0
FFS

Classes Jay, use classes!
Sunday, 17 January 2010, 11:51
JL235
Afro FFS

Classes Jay, use classes!

For something this simple, I disagree. They are utility functions that don't preserve state between calls. Why do they need to be in their own class? Their own file or module is enough to seperate them out from the rest of the application or library.

However I would say that you should be aware that different users will generate different timestamps because of timezone differences. So essentially only rely on this for local stuff, don't rely on it for say a scoreboard!
Sunday, 17 January 2010, 11:58
Jayenkai
Yeah, I've currently decided against online scores, since.. well, it's all kinda mangled up at the minute.

And, these aren't "Unix" timestamps, they're just bog-standard ones, but they are 100% reusable, and as such, completely worthwhile having!!


. and, in fact, they ARE for a local scoreboard, so you can flick through a nice graph, with all your previous scores on it..
Mmmmmm....
Graph!!!
Sunday, 17 January 2010, 16:10
Afr0
I just noticed you're generating big-ass numbers.
Might wanna look into Big Integers.
Sunday, 17 January 2010, 16:31
JL235
He's using longs, which is standard for holding time values.

In what way would big integers be more appropriate?

|edit| When I said don't use them for a score board, I meant for an online scoreboard. |edit|
Sunday, 17 January 2010, 16:40
Jayenkai
It shouldn't ever hit anything too big.
Or at least, not until the year 10000, (he says, giving it a run through) whereby the 4 digit display thing kinda starts to limit the year number.
Monday, 18 January 2010, 10:19
Jayenkai
I've not got to the stage of messing with mods yet. At the minute, I'm trying to keep everything "Code Only", so I know it'll (should!) run on all 3 main targets without all the faffing about.

The number of Blitz things that have been broken, 'cos I've lost track of certain versions of specific userlibs, or because I updated one userlib, and it broke something else..
It's completely insane, so I'm trying to keep things in the code folder as much as possible.

Maybe later!!
Monday, 18 January 2010, 15:03
Jayenkai
Would that happily work on all 3 targets? (Win/Linux/Mac)
I'm being very very aware of completely screwing this up, and am taking baby steps so I know what broke it all!

(although I've still no mac to test with, so it'll all come crashing down anyway!!)
Monday, 18 January 2010, 21:08
mindstorm8191
Or at least, not until the year 10000,


You'd better fix that now, Jay, or else it'll be Y2K all over again! lol
Tuesday, 19 January 2010, 02:56
Jayenkai
I've lived with the Millisecs thing for so long, avoiding it is second nature, especially when dealing with the whole wraparound thing. (does it still do that?)

OK, I'll have a piss about with this stuff later.
Today's task is to get this test engine finished, and uploaded for people to try out.
Using "Test Engine" as "AGameAWeek"..
Only if it's good enough!!