The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OP::TimeSpan - Time range object class

VERSION

  $Id: //depotit/tools/source/snitchd-0.20/lib/OP/TimeSpan.pm#8 $

SYNOPSIS

  use OP::TimeSpan;

  my $time = OP::TimeSpan->new( 60*5 );

DESCRIPTION

Extends OP::Object, Time::Seconds.

Stringifies as number of seconds unless overridden.

PUBLIC CLASS METHODS

  • assert(OP::Class $class: *@rules)

    Returns a new OP::Type::TimeSpan instance which encapsulates the received OP::Subtype rules.

      create "OP::Example" => {
        someTime  => OP::TimeSpan->assert(optional()),
    
        # ...
      };
  • new(OP::Class $class: Num $secs)

    Returns a new OP::TimeSpan instance which encapsulates the received value.

      my $object = OP::TimeSpan->new($secs);

SEE ALSO

See the Time::Seconds module for time formatting and manipulation methods inherited by this class.

This file is part of OP.