Just some "gettime" questions.
#2

The function on its own, without parameters, returns a unix timestamp; the number of seconds elapsed since the epoch on 1/1/1970. If you (for example) want to give someone a premium account for a month, you add 2678400 seconds to the current timestamp (60 seconds in a minute, times 60 minutes in an hour, times 24 hours in a day, times 31 days in a month). Then save that new value in their account. Every time they log in, check if the value is smaller than the current timestamp. If it is, then their premium has expired.

You can also measure time. Save a timestamp once they log on. When they log off get the current timestamp and subtract the one you saved earlier. You will end up with a value in seconds, which can be converted to hours and minutes.
Reply


Messages In This Thread
Just some "gettime" questions. - by Kyance - 22.12.2013, 19:02
Re: Just some "gettime" questions. - by Vince - 22.12.2013, 19:18
Re: Just some "gettime" questions. - by CutX - 22.12.2013, 19:38
Re: Just some "gettime" questions. - by Kyance - 23.12.2013, 05:56

Forum Jump:


Users browsing this thread: 3 Guest(s)