Java Second Convert seconds2timecents(double seconds)

Here you can find the source of seconds2timecents(double seconds)

Description

secondstimecents

License

Open Source License

Parameter

Parameter Description
seconds the time in seconds

Return

the converted timecents [-32768...+32767]

Declaration

public static final int seconds2timecents(double seconds) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from  w w  w. j a v a  2  s  . co m*/
     * @param seconds the time in seconds
     * @return the converted timecents [-32768...+32767]
     */
    public static final int seconds2timecents(double seconds) {
        if (seconds <= 0) {
            return -32768;
        } else if (seconds >= 165910888) {
            return 32767;
        }
        // TODO: use a table
        return (int) (1200.0 * Math.log(seconds) / Math.log(2));
    }
}

Related

  1. convertToTenthsOfASecond(long epochSeconds, int nanos)
  2. secondConvertToString(final long spentSeconds)
  3. seconds2microseconds(double secs)
  4. seconds2String(long seconds)
  5. seconds2time(long seconds)
  6. secondsToCycles(double secs, double hz)
  7. secondsToHHMMSS(int secs)
  8. secondsToHHMMSS(long secs)
  9. secondsToHour(int time)