time.runits

STRINGtime.runitsSTRINGunitRTIMErtime

Available in all subroutines.

Returns a string representation of the given RTIME typed time value expressed to the resolution specified by the unit.

Parameters

  • unit - A string of one of the four possible unit values: s, ms, us, ns.
  • rtime - A time value parameter of type RTIME.

Return Value

The return value will be of type STRING, being the text based representation of the given time value formatted according to the unit type as specified by the following criteria:

UnitDescription
sWhole seconds only with no decimal point
msWhole seconds followed by a decimal point with three decimal places
usWhole seconds followed by a decimal point with six decimal places
nsWhole seconds followed by a decimal point with nine decimal places

Errors

If the unit argument is not a valid unit string, then fastly.error will be set to EINVAL.

Example

set beresp.X-Connect-Time-Taken = time.runits("ns", time.beconn.connect_direct);

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.