Here you can find the source of getTicksTillHour()
public static long getTicksTillHour()
//package com.java2s; /*// w w w.j a va 2s . c o m * Copyright (c) 2014 Wyatt Childers. * * This file is part of Aurora. * * Aurora is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Aurora is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public * License along with Aurora. If not, see <http://www.gnu.org/licenses/>. */ import java.util.Calendar; public class Main { private static Calendar calendar = Calendar.getInstance(); /** * Gets the ticks till the start of the next hour * * @return the number of ticks till the next hour */ public static long getTicksTillHour() { Calendar localCalendar = Calendar.getInstance(); long returnValue; localCalendar.set(Calendar.MINUTE, 0); localCalendar.add(Calendar.HOUR_OF_DAY, 1); returnValue = localCalendar.getTimeInMillis() - calendar.getTimeInMillis(); returnValue = (returnValue / 1000) * 20; // To Ticks return returnValue; } }