core :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: TimeT :: defaultinit
core :: Object :: defaultinit
core :: Pointer :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Time since epoch
extern class TimeT `{time_t`}
# Returns Time since epoch from now.
new `{ return time(NULL); `}
# Returns Time since epoch from `i` (expressed in seconds).
new from_i(i: Int) `{ return i; `}
# Update current time.
fun update `{ time(&self); `}
# Convert `self` to a human readable String.
fun ctime: String import CString.to_s `{
return CString_to_s( ctime(&self) );
`}
# Difference in secondes from start (self if the end time)
fun difftime(start: TimeT): Float `{ return difftime(self, start); `}
redef fun to_s do return ctime.replace("\n", "")
# Convert self to Int (expressed as seconds since epoch).
fun to_i: Int `{ return (int)self; `}
end
lib/core/time.nit:74,1--98,3