inria.util
Class NTP
java.lang.Object
|
+--inria.util.NTP
- public class NTP
- extends java.lang.Object
Translate UNIX time to NTP time.
NTP time is UTC time relative to 01/Jan/1900.
Constructor Summary |
NTP()
|
Method Summary |
static int |
fixedPoint32ToMillis(int fixed)
converts a 32 bit fixed point integer to milliseconds. |
static void |
main(java.lang.String[] args)
|
static long |
millis(long ntp)
converts 64 bit NTP time to UNIX time in milliseconds. |
static int |
millisToFixedPoint32(int millis)
converts milliseconds to 32 bit fixed point integer. |
static int |
ntp32(long millis)
converts UNIX time to 32 bit NTP time, i.e., 32-bit fixed point integer
(with fraction point at bit 16). |
static long |
ntp64(long millis)
converts UNIX time in milliseconds to NTP time, i.e., 64-bit fixed point
(with fraction point at bit 32). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NtpOffsetSeconds
public static final long NtpOffsetSeconds
NtpOffsetMillis
public static final long NtpOffsetMillis
NTP
public NTP()
ntp64
public static long ntp64(long millis)
- converts UNIX time in milliseconds to NTP time, i.e., 64-bit fixed point
(with fraction point at bit 32). The low 32 bits are the fraction part in
1/2^32 second units.
- Parameters:
millis
- the UNIX time.
ntp32
public static int ntp32(long millis)
- converts UNIX time to 32 bit NTP time, i.e., 32-bit fixed point integer
(with fraction point at bit 16). The low 16 bits are the fraction part in
1/2^16 second units.
- Parameters:
millis
- the UNIX time.
millis
public static long millis(long ntp)
- converts 64 bit NTP time to UNIX time in milliseconds.
- Parameters:
ntp
- the ntp time.
millisToFixedPoint32
public static int millisToFixedPoint32(int millis)
- converts milliseconds to 32 bit fixed point integer.
- Parameters:
millis
- the milliseconds.
fixedPoint32ToMillis
public static int fixedPoint32ToMillis(int fixed)
- converts a 32 bit fixed point integer to milliseconds.
- Parameters:
fixed
- the 32 bit fixed point integer.
main
public static void main(java.lang.String[] args)
JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.