[Tutorial] Julian Day [Similar to timestamps]
#5

Couldn't you just use an a mod b setup where a is the number of milliseconds (3600s = 1 hour) in UNIX time (time()) and b is 86400 (or the sec equivalent of 24 hours).

Example:
1420348413 [01/04/2015 @ 5:13am (UTC)] from UNIX time is the time a ban is set for 6 days (and the number of days the ban is long is set to banDays). If this variable is set to banTime...

You could do this-

if(banTime % 3600 > banDays) unbanPlayer(playerid);
else Kick(playerid);

The mod of the ban time in UNIX time and 3600 would yield the number of hours since the ban was set.

The only purpose Julian time serves is in large picture things. UNIX time is basically the same as Julian time, just starts on January 1st, 1970 instead of in 4714 BC...
Reply


Messages In This Thread
Julian Day [Similar to timestamps] - by BroZeus - 29.12.2014, 14:43
Re: Julian Day [Similar to timestamps] - by Pitter - 29.12.2014, 14:45
Re: Julian Day [Similar to timestamps] - by Cyber123 - 30.12.2014, 00:20
Re: Julian Day [Similar to timestamps] - by nelly - 30.12.2014, 13:14
Re: Julian Day [Similar to timestamps] - by Lawbringer - 04.01.2015, 04:34

Forum Jump:


Users browsing this thread: 3 Guest(s)