System time in ZScript

Moderator: GZDoom Developers

User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: System time in ZScript

Post by ZZYZX »

I can already easily detect savegames by comparing level time at global map load handler. I don't understand the concerns.
I can even store my precious terrywad-critical information between saves and loads by using a cvar! (but I could also store global player progress and inventory there)

(Sep 07 is an old post? :о)
User avatar
Rachael
Posts: 13562
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: System time in ZScript

Post by Rachael »

ZZYZX wrote:(Sep 07 is an old post? :о)
If you're going to make an argument about a comment out of context without taking into account the context within which the point was made, it's not only foolish, but it's a waste of time, and quite annoying to boot.

Don't do that.

And if this savegame discussion continues I will not invest any effort into this feature at all. I'm already quite sick of it and it already seems not worth it with people more interested in pointlessly arguing a point that's already been conceded, than they are in any actual productive or constructive discussion about it.
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: System time in ZScript

Post by 3saster »

Any word on this? It, uh, seems to have gone dormant...

I simply ask because it seems that since you are okay with UI-scope only, all that would need to be done is make this method public. I'll say that it does make the location in althud a little odd though.

Since Nightfright and I largely just want this for our own mod, I'd be willing to do the work myself, but I need to be clear on the specifications. This is what I am thinking:
  • Make a Clock class that is UI-scope in ZScript.
  • Add the static native public methods GetTime(), which returns the Unix timestamp, and GetRealTime(), which returns the Unix timestamp taking timezone into account.
  • Add a static public method SetTime() that lets you set the current time (i.e. a debug override).
  • Make a global variable of this type that can be accessed directly.
Does this seem okay, or totally off? Are there any other things to consider?
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: System time in ZScript

Post by _mental_ »

Points one and two seem OK, the third one is WTF, and the forth is “sorry, I didn’t get it” too.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: System time in ZScript

Post by Graf Zahl »

What's the point of Unix time? Getting that displayed requires quite a bit of support code.
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: System time in ZScript

Post by 3saster »

GetRealTime() can be trivially implemented, because, well, it already exists :P I agree that GetTime() doesn't make much sense unless SetTime() is implemented, which I only suggested cause Rachel suggested a debug parameter did earlier. The global idea was stupid, because I went full dumb and forgot the methods were static. Perhaps I'll just go ahead and make a PR, and we move the discussion there.
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: System time in ZScript

Post by 3saster »

User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: System time in ZScript

Post by ZZYZX »

Graf Zahl wrote:What's the point of Unix time? Getting that displayed requires quite a bit of support code.
Yup, I'd rather have something like strftime() ported. This time we also don't need any 64-bit ints :)

(edit: actually looked at 3saster's code and there is strftime)
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: System time in ZScript

Post by 3saster »

This was added in 4.5.0 and can be closed. See relevant wiki page.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”