Fixed BotReportTable calendar schedule calculations.
This commit is contained in:
		@@ -120,16 +120,17 @@ public class BotReportTable
 | 
			
		||||
			long lastResetTime = 0;
 | 
			
		||||
			try
 | 
			
		||||
			{
 | 
			
		||||
				final String[] hour = Config.BOTREPORT_RESETPOINT_HOUR;
 | 
			
		||||
				final Calendar c = Calendar.getInstance();
 | 
			
		||||
				c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour[0]));
 | 
			
		||||
				c.set(Calendar.MINUTE, Integer.parseInt(hour[1]));
 | 
			
		||||
				if (System.currentTimeMillis() < c.getTimeInMillis())
 | 
			
		||||
				final int hour = Integer.parseInt(Config.BOTREPORT_RESETPOINT_HOUR[0]);
 | 
			
		||||
				final int minute = Integer.parseInt(Config.BOTREPORT_RESETPOINT_HOUR[1]);
 | 
			
		||||
				final long currentTime = System.currentTimeMillis();
 | 
			
		||||
				final Calendar calendar = Calendar.getInstance();
 | 
			
		||||
				calendar.set(Calendar.HOUR_OF_DAY, hour);
 | 
			
		||||
				calendar.set(Calendar.MINUTE, minute);
 | 
			
		||||
				if (calendar.getTimeInMillis() < currentTime)
 | 
			
		||||
				{
 | 
			
		||||
					c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) - 1);
 | 
			
		||||
					calendar.add(Calendar.DAY_OF_YEAR, 1);
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				lastResetTime = c.getTimeInMillis();
 | 
			
		||||
				lastResetTime = currentTime;
 | 
			
		||||
			}
 | 
			
		||||
			catch (Exception e)
 | 
			
		||||
			{
 | 
			
		||||
@@ -414,16 +415,17 @@ public class BotReportTable
 | 
			
		||||
	{
 | 
			
		||||
		try
 | 
			
		||||
		{
 | 
			
		||||
			final String[] hour = Config.BOTREPORT_RESETPOINT_HOUR;
 | 
			
		||||
			final Calendar c = Calendar.getInstance();
 | 
			
		||||
			c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour[0]));
 | 
			
		||||
			c.set(Calendar.MINUTE, Integer.parseInt(hour[1]));
 | 
			
		||||
			if (System.currentTimeMillis() > c.getTimeInMillis())
 | 
			
		||||
			final int hour = Integer.parseInt(Config.BOTREPORT_RESETPOINT_HOUR[0]);
 | 
			
		||||
			final int minute = Integer.parseInt(Config.BOTREPORT_RESETPOINT_HOUR[1]);
 | 
			
		||||
			final long currentTime = System.currentTimeMillis();
 | 
			
		||||
			final Calendar calendar = Calendar.getInstance();
 | 
			
		||||
			calendar.set(Calendar.HOUR_OF_DAY, hour);
 | 
			
		||||
			calendar.set(Calendar.MINUTE, minute);
 | 
			
		||||
			if (calendar.getTimeInMillis() < currentTime)
 | 
			
		||||
			{
 | 
			
		||||
				c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) + 1);
 | 
			
		||||
				calendar.add(Calendar.DAY_OF_YEAR, 1);
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			ThreadPool.schedule(new ResetPointTask(), c.getTimeInMillis() - System.currentTimeMillis());
 | 
			
		||||
			ThreadPool.schedule(new ResetPointTask(), calendar.getTimeInMillis() - currentTime);
 | 
			
		||||
		}
 | 
			
		||||
		catch (Exception e)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user