Available inall subroutines.

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


  • unit - A string of one of the four possible unit types - s, ms, us, ns.
  • time - A time value parameter of type TIME.

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:

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


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


set resp.http.X-Request-Start-Time = time.units("s", time.start);