Name
SPVM::Sys::Time::Timeval - struct timeval in the C language
Description
Sys::Time::Timeval class in SPVM represents struct timeval in the C language.
Usage
use Sys::Time::Timeval;
my $tv = Sys::Time::Timeval->new;
my $tv = Sys::Time::Timeval->new(5, 100_000);
my $tv_sec = $tv->tv_sec;
$tv->set_tv_sec(12);
my $tv_usec = $tv->tv_usec;
$tv->set_tv_usec(34);
Class Methods
new
static method new : Sys::Time::Timeval ($tv_sec : long = 0, $tv_usec : long = 0);
Creates a new Sys::Time::Timeval object with the given "tv_sec" and "tv_usec".
Before creating the object, this method calls "check" to validate the range of the arguments. If the arguments are invalid, an exception is thrown.
check
static method check : void ($tv_sec : long, $tv_usec : long);
Validates the range of the given "tv_sec" and "tv_usec".
If "tv_usec" is not greater than or equal to 0 and less than or equal to 999,999, an exception is thrown.
Instance Methods
tv_sec
method tv_sec : long ();
Returns tv_sec.
set_tv_sec
method set_tv_sec : void ($tv_sec : long);
Sets tv_sec.
tv_usec
method tv_usec : long ();
Returns tv_usec.
set_tv_usec
method set_tv_usec : void ($tv_usec : long);
Sets tv_usec.
clone
method clone : Sys::Time::Timeval ();
Creates a new Sys::Time::Timeval object that is a copy of the current instance.
The new object will have the same "tv_sec" and "tv_usec" values as the original.
See Also
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License