Giter Site home page Giter Site logo

haproxytime's Introduction

haproxytime

haproxytime is a command-line utility designed to facilitate the conversion of human-readable time durations into a format precisely represented in milliseconds, tailored specifically for HAProxy configurations.

This tool is useful for developers and administrators who work with HAProxy, providing a straightforward mechanism to ensure that timeout configurations are accurately specified in a format that HAProxy can understand. Whether you're inputting durations directly or piping them from standard input, haproxytime streamlines the process of dealing with time durations, supporting a wide range of units from days to microseconds. With features to display durations in both machine- and human-readable formats, as well as the ability to print the maximum HAProxy timeout value, haproxytime minimises the risk of configuration errors in your HAProxy setup.

Install

To install without versioning information:

$ go install github.com/frobware/haproxytime@latest

To install with versioning information:

$ go install -ldflags "-X 'main.buildVersion=$(git describe --tags --abbrev=8 --dirty --always --long)'" github.com/frobware/haproxytime@latest

Usage

haproxytime - Convert human-readable time duration to millisecond format

General Usage:
  haproxytime [-help] [-v]
  haproxytime [-h] [-m] [<duration>]

Usage:
  -help Show usage information
  -v	Show version information
  -h	Print duration value in a human-readable format
  -m	Print the maximum HAProxy timeout value
  <duration>: value to convert. If omitted, will read from stdin.

The flags [-help] and [-v] are mutually exclusive with any other
options or duration input.

Available units for time durations:
  d   days
  h:  hours
  m:  minutes
  s:  seconds
  ms: milliseconds
  us: microseconds

A duration value without a unit defaults to milliseconds.

Examples:
  haproxytime -m           -> Print the maximum HAProxy duration.
  haproxytime 2h30m5s      -> Convert duration to milliseconds.
  haproxytime -h 4500000   -> Convert 4500000ms to a human-readable format.
  echo 150s | haproxytime  -> Convert 150 seconds to milliseconds.

Build

$ make
$ make install

haproxytime's People

Contributors

frobware avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.