COLLAPSE ALL
  • Home
  • About Pixie
    • Pixie Overview
    • Data Sources
    • How Pixie uses eBPF
    • Roadmap
    • FAQ
    • Troubleshooting
  • Installing Pixie
    • Requirements
  • Using Pixie
    • Using the Live UI
    • Using the CLI
    • Using the API
  • Tutorials
  • Reference
    • Architecture
    • PxL
      • Compile Time Functions
        • px.days
        • px.equals_any
        • px.format_duration
        • px.hours
        • px.make_upid
        • px.microseconds
        • px.milliseconds
        • px.minutes
        • px.now
        • px.parse_duration
        • px.parse_time
        • px.script_reference
        • px.seconds
        • px.strptime
        • px.uint128

px.parse_duration

Parse a duration string to a duration in nanoseconds.

Parse a duration string ("-5m") to integer nanoseconds (-3,000,000,000) while preserving the sign from the string.

Arguments

NameTypeDescription
durationstringThe duration in string form.

Returns

px.Duration: The duration in nanoseconds.

Examples

# duration = -300000000000
duration = px.parse_duration("-5m")
# duration = 300000000000
duration = px.parse_duration("5m")

This site uses cookies to provide you with a better user experience. By using Pixie, you consent to our use of cookies.