otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.6k stars 1.06k forks source link

[Suggestion] premend instead of premdays and lastday #2436

Closed slawkens closed 4 years ago

slawkens commented 6 years ago

I suggest removing premdays and lastday columns from the table accounts and replace them with premend. Why? Its easier to maintain, understand and doesn't require ANY database updates when servers starts or when account is loaded. Its then easier to calculate from database when Premium Account ends, without performing any arithmetical operations on the both values to get the current time.

Also, OpenTibia and many other distros based on it are already using premend, so its some kind of standard.

And finally: it uses less memory, as its only one column instead of two 😃

What do you guys think?

ranisalt commented 6 years ago

If I had a server, I would store premium time on a separate table to track all premium time spells.

That said, I agree that it's much better. premdays and lastday come from a time it was much harder to handle time on C++, but since <chrono> points and durations it is not an issue anymore.

pzaj2 commented 6 years ago

How far do you think these changes should reach? Only premiumDays or perhaps all things involving time arithmetics?

P.S. I've started working on that in my spare time.