Help language development. Donate to The Perl Foundation

TimeUnit cpan:ATROXAPER last updated on 2017-10-13

TimeUnit-0.1.2/

Build Status

TimeUnit

Library for conversion a time unit to another.

Purpose

Exported constants

nanos - just nanoseconds;

micros - is a thousand of nanoseconds;

millis - is a thousand of microseconds;

seconds - is a thousand of milliseconds;

minutes - is sixty seconds;

hours - is sixty minutes;

days - is twenty four hours;

Available methods

With any constants you can use methods from, to-nanos, to-micros, to-millis, to-seconds, to-minutes, to-hours, to-days for conversion numbers from one unit to another like this:

    nanos.to-hours(432);      # convert 432 nanosecons to 0.00000000012 hour
    hours.from(90, minutes);  # retrieve 1.5 hours from 90 minutes
    seconds.from(:17minutes); # retrieve 1020 seconds 17 minutes in short named form
    minutes.from(hours => 3.6);
        # retrieve 216 minutes from 3.6 (3:36) hours in full named form

Sources

GitHub

Author

Mikhail Khorkov [email protected]

License

See LICENSE file for the details of the license of the code in this repository.