SyntaxBomb - Indie Coders

Languages & Coding => BlitzMax / BlitzMax NG => Topic started by: Adam Novagen on December 13, 2019, 17:43:55

Title: [BMax 1.50] Does MilliSecs() return Int or Long?
Post by: Adam Novagen on December 13, 2019, 17:43:55
Title says it all. This is such a hilariously simple question I almost feel dumb for asking, but I can't for the life of me find any indication of what value MilliSecs() returns. I'm just looking to make a totally accurate playtime calculator for my engine, but obviously I need to account for the possibility of MilliSecs() looping into the negatives, which means I need to know its maximum range.
Title: Re: [BMax 1.50] Does MilliSecs() return Int or Long?
Post by: _PJ_ on December 13, 2019, 18:22:20
It returns an Integer
However, it can be passed to a Long in 64-bit
Title: Re: [BMax 1.50] Does MilliSecs() return Int or Long?
Post by: Adam Novagen on December 14, 2019, 03:48:08
Quote from: _PJ_ on December 13, 2019, 18:22:20
It returns an Integer
However, it can be passed to a Long in 64-bit
Okay. This means that, by default, it will loop at 2147483647, right? i.e. even if I store the value in a Long variable, the initial value returned by MilliSecs() will switch to negative once it passes 2^31?
Title: Re: [BMax 1.50] Does MilliSecs() return Int or Long?
Post by: Derron on December 14, 2019, 07:56:46
Checkout MillisecsLong() at
https://github.com/GWRon/Dig/blob/master/base.util.time.bmx

Bye
Ron
Title: Re: [BMax 1.50] Does MilliSecs() return Int or Long?
Post by: Adam Novagen on December 14, 2019, 23:28:34
Oooooh, that is an excellent set of Types, will definitely use that. Thanks a million, Ron! Is this your own work?
Title: Re: [BMax 1.50] Does MilliSecs() return Int or Long?
Post by: Derron on December 15, 2019, 06:47:12
This very special function is copied from the source mentioned there. If there is no source mentioned it is most probably my code.


Bye
Ron