Optimization of code based on dates
#5

Quote:
Originally Posted by maramizo
Посмотреть сообщение
So time is basically made of minutes, correct? And you use a loop to decrease minutes?
edit:
minutes/hours etc.
Time is basically made out of days, actually. The only thing alternating is days. 60 minutes are always an hour, 24 hours are always a day, 12 months are always a year, but a month can be both 28, 29, 30 and 31 days.

I loop the value I add to - if I ban someone for 20 days, I'll run a loop on the current day + 20. If I ban someone for 20 months, I'll run a loop on the current month + 20. All this to adjust the higher values.

For minutes, I have to adjust hours, days, months and years.
For hours, I have to adjust days, months and years.
For days, I have to adjust months and years.
And lastly for months, I have to adjust years and sometimes days (because of the alternating days in a month + leap years).
Reply


Messages In This Thread
Optimization of code based on dates - by LarzI - 13.12.2012, 23:30
Re: Optimization of code based on dates - by Jefff - 13.12.2012, 23:56
Re: Optimization of code based on dates - by LarzI - 13.12.2012, 23:58
Re: Optimization of code based on dates - by maramizo - 13.12.2012, 23:58
Re: Optimization of code based on dates - by LarzI - 14.12.2012, 00:05
Re: Optimization of code based on dates - by maramizo - 14.12.2012, 00:18
Re: Optimization of code based on dates - by LarzI - 14.12.2012, 00:24
Re: Optimization of code based on dates - by maramizo - 14.12.2012, 00:35
Re: Optimization of code based on dates - by LarzI - 14.12.2012, 01:31
Re: Optimization of code based on dates - by maramizo - 14.12.2012, 02:07

Forum Jump:


Users browsing this thread: 2 Guest(s)