Raised This Month: $32 Target: $400
 8% 

Timestamp + max integer value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
damage220
Member
Join Date: Jul 2022
Location: Ukraine
Old 01-21-2023 , 10:42   Timestamp + max integer value
Reply With Quote #1

I use unix timestamp to store date, but since the language has no unsigned int the max date I could store in an integer is "Tue Jan 19 2038 03:14:07 GMT+0000". Is this something that will be fixed in the future or what? I mean will the dev update compiler? Maybe they already did and I just missed it? More general question would be: How can I store dates after 2038 year?

https://www.compuphase.com/pawn/pawnhistory.htm
There is note in changelog that compiler could produce 64-bit amx files. AFAIK amxmodx does not use mainstream version of compiler but a fork which had no updates since 2005 or something.

Is it possible to run core plugins compiled in 32-bit version and my plugins compiled with 64-bit support?

Last edited by damage220; 01-21-2023 at 10:51.
damage220 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-21-2023 , 13:04   Re: Timestamp + max integer value
Reply With Quote #2

You can't compile for 64-bit because 1) it's not supported by the compiler and 2) the server is a 32-bit application and everything loaded into memory by a process must be of the same bitness. Also, changing the bitness doesn't actually make variables bigger or change them from signed to unsigned.

What exactly are you trying to do? I suspect that there is another way to do it.
__________________
fysiks is offline
damage220
Member
Join Date: Jul 2022
Location: Ukraine
Old 01-21-2023 , 13:41   Re: Timestamp + max integer value
Reply With Quote #3

I am writing a plugin to ban players. Ban list is stored in file and expiry date is represented in unix timestamp. I do not feel like using strings for that would be reasonable. There is also add time in the file which is also a number. The only thought that came to my mind is to sacrifice accuracy and use only year. Also, will the format_time function do the job in 2039?

Last edited by damage220; 01-21-2023 at 13:46.
damage220 is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 01-21-2023 , 15:46   Re: Timestamp + max integer value
Reply With Quote #4

you're thinking very far ahead
__________________
bigdaddy424 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-21-2023 , 16:14   Re: Timestamp + max integer value
Reply With Quote #5

The people you ban for that long are most likely going to not be playing the game anymore by then (assuming that anyone, even you, still has a server up). Should probably just ban them permanently if you're looking out that far. Also, there are still 20+ more years to figure out this issue.
__________________
fysiks is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 01-21-2023 , 18:04   Re: Timestamp + max integer value
Reply With Quote #6

stop overengineering your ban plugin, use this instead https://forums.alliedmods.net/showthread.php?t=80858

Last edited by lexzor; 01-21-2023 at 18:04.
lexzor is offline
damage220
Member
Join Date: Jul 2022
Location: Ukraine
Old 01-22-2023 , 06:21   Re: Timestamp + max integer value
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
The people you ban for that long are most likely going to not be playing the game anymore by then (assuming that anyone, even you, still has a server up). Should probably just ban them permanently if you're looking out that far. Also, there are still 20+ more years to figure out this issue.
True, except that there are 15+ years. I do not want to ban for that long, I am just curious what it would like when the time comes in. Am I correct that by the time all time related functions: get_systime, format_time, ..., will stop to work without updates for compiler?
damage220 is offline
damage220
Member
Join Date: Jul 2022
Location: Ukraine
Old 01-22-2023 , 06:28   Re: Timestamp + max integer value
Reply With Quote #8

Quote:
Originally Posted by lexzor View Post
stop overengineering your ban plugin, use this instead https://forums.alliedmods.net/showthread.php?t=80858
Writing plugins for my favorite game is one of the most exciting experience I have ever had in programming. So I will definitely continue to do this) Thank you for the plugin, I will use it for reference.
damage220 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-22-2023 , 14:00   Re: Timestamp + max integer value
Reply With Quote #9

Quote:
Originally Posted by damage220 View Post
True, except that there are 15+ years. I do not want to ban for that long, I am just curious what it would like when the time comes in. Am I correct that by the time all time related functions: get_systime, format_time, ..., will stop to work without updates for compiler?
Yeah, I was accidentally 10 years off (I subtracted 5 of my original assumption to give time to actually worry about it). It's exactly 15 years from 3 days ago. Regardless, it's going to be the same issue that every piece of software that uses a signed 32-bit integer for the timestamp. I haven't personally done a whole ton of research on the problem but I suspect that AMX Mod X, if it survives, will adopt the industry common solution provided that dependencies are also "fixed".
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode