Here you can find the source of getSeconds(double t)
double
time value.
Parameter | Description |
---|---|
t | time value in hours. |
double
value of seconds.
public static double getSeconds(double t)
//package com.java2s; //License from project: Open Source License public class Main { /**/*w w w . j av a 2 s . c o m*/ * Returns full number of seconds for given <code>double</code> time value. * @param t time value in hours. * @return <code>double</code> value of seconds. */ public static double getSeconds(double t) { double tt = (t - getHours(t)) * 60; tt = (tt - getMinutes(t)) * 60; return Math.min(tt, 59.9); } /** * Returns full number of hours for given <code>double</code> time value. * @param t time value in hours. * @return <code>int</code> value of hours. */ public static int getHours(double t) { return (int) Math.floor(t); } /** * Returns full number of minutes for given <code>double</code> time value. * @param t time value in hours. * @return <code>int</code> value of minutes. */ public static int getMinutes(double t) { double tt = (t - getHours(t)) * 60; return (int) Math.floor(tt); } }