Java Minute Convert onMinute(int minute)

Here you can find the source of onMinute(int minute)

Description

Used to check if the current minutes is on the time multiple of the given variable

License

Creative Commons License

Parameter

Parameter Description
minute What minute, for instance checking on 5 will trigger every 5 minutes

Return

True if on time

Declaration

public static boolean onMinute(int minute) 

Method Source Code

//package com.java2s;
/**// w ww .  j  a v  a2 s.  co  m
 * This file was created for Bookshelf
 *
 * Bookshelf is licensed under the
 * Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License:
 * http://creativecommons.org/licenses/by-nc-sa/4.0/
 *
 * @author Paul Davis - pauljoda
 * @since 2/14/2017
 */

public class Main {
    public static long tick = 0;

    /**
     * Used to check if the current minutes is on the time multiple of the given variable
     * @param minute What minute, for instance checking on 5 will trigger every 5 minutes
     * @return True if on time
     */
    public static boolean onMinute(int minute) {
        return minutes() % minute == 0;
    }

    /**
     * How many minutes on
     *
     * @return Minutes, floored
     */
    public static int minutes() {
        return (int) Math.floor(seconds() / 60);
    }

    /**
     * The seconds online
     *
     * @return How many seconds on, floored
     */
    public static int seconds() {
        return (int) Math.floor(tick / 20);
    }
}

Related

  1. minutesToTicks(double x)
  2. minutesToTicks(int minutes)
  3. minutesToTime(int inTime)
  4. minuteToMillis(long minute)
  5. minuteToTime(int minute)