SnmpTimetickspublic class SnmpTimeticks extends SnmpUnsignedInt Contains an SnmpTimeTick value which
has units of 1/100th of a second.
This API is a Sun Microsystems internal API and is subject
to change without notice. |
Fields Summary |
---|
static final String | nameName of the type. | private static final long | serialVersionUID |
Constructors Summary |
---|
public SnmpTimeticks(int v)Constructs a new SnmpTimeticks from the specified
integer value.
super(v) ;
| public SnmpTimeticks(Integer v)Constructs a new SnmpTimeticks from the specified
Integer value.
super(v) ;
| public SnmpTimeticks(long v)Constructs a new SnmpTimeticks from the specified long
value.
If the specified value is greater than {@link
SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}, the SnmpTimeTicks
will be initialized with v%(SnmpUnsignedInt.MAX_VALUE+1) .
super(((v>0)?v&SnmpUnsignedInt.MAX_VALUE:v)) ;
| public SnmpTimeticks(Long v)Constructs a new SnmpTimeticks from the specified
Long value.
If the specified value is greater than {@link
SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}, the SnmpTimeTicks
will be initialized with v%(SnmpUnsignedInt.MAX_VALUE+1) .
this(v.longValue()) ;
|
Methods Summary |
---|
public final java.lang.String | getTypeName()Returns a textual description of the type object.
return name;
| public static final java.lang.String | printTimeTicks(long timeticks)Parses the specified long value with time units and
returns a String of the form d days hh:mm:ss .
int seconds, minutes, hours, days;
StringBuffer buf = new StringBuffer() ;
timeticks /= 100;
days = (int)(timeticks / (60 * 60 * 24));
timeticks %= (60 * 60 * 24);
hours = (int)(timeticks / (60 * 60)) ;
timeticks %= (60 * 60);
minutes = (int)(timeticks / 60) ;
seconds = (int)(timeticks % 60) ;
if (days == 0) {
buf.append(hours + ":" + minutes + ":" + seconds) ;
return buf.toString() ;
}
if (days == 1) {
buf.append("1 day ") ;
} else {
buf.append(days + " days ") ;
}
buf.append(hours + ":" + minutes + ":" + seconds) ;
return buf.toString() ;
| public final java.lang.String | toString()Converts the timeticks value to its String form.
The format of the returned String is d days hh:mm:ss .
Note: this method simply calls the {@link #printTimeTicks printTimeTicks} method.
return printTimeTicks((long)value) ;
|
|