NAME

Google::gRPC::Deadline - Parsing and formatting for gRPC grpc-timeout headers

SYNOPSIS

use Google::gRPC::Deadline;

my $seconds = Google::gRPC::Deadline::parse_timeout('500m');   # 0.5
my $header  = Google::gRPC::Deadline::format_grpc_timeout(30); # '30S'

DESCRIPTION

Google::gRPC::Deadline converts between numeric seconds and the gRPC HTTP/2 grpc-timeout wire format (n nanoseconds, u microseconds, m milliseconds, S seconds, M minutes, H hours).

FUNCTIONS

parse_timeout( $value )

Parses a numeric timeout in seconds or a gRPC timeout string (e.g., '500m', '30S', '2M', '1H') and returns fractional seconds. Croaks on invalid format.

format_grpc_timeout( $seconds )

Formats a timeout value into a canonical gRPC grpc-timeout header string (e.g., '250m', '30S', '5M').

SEE ALSO

Google::gRPC, Google::gRPC::Client, Google::gRPC::Channel

AUTHOR

C.J. Collier <cjac@google.com>

LICENSE

Apache License 2.0