Skip to main content

Easily convert differt time-range format to standard ones

Project description

codecov

ENV Time Converter

Easily manage different time interval values and convert them to milliseconds. You can use this project to set a more readable info on your .env, .yaml or other configuration file.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

  • Poetry >=0.12
  • Python ^3.5
  • Virtualenvwrapper or other virtualenv environment
  • make utility

Installing

Clone or download the repository

git clone https://github.com/massicer/Env-Time-Converter.git

Install project package

make install

or without the make utility

poetry install

Running the tests

Simply type

make test

How To use

Available time formats

Unit Measure Allowed Sigles default
milliseconds ms , milliseconds, sec X
seconds seconds , s, sec
minutes min , minute, minutes
hours h , hours, hrs, hour
days d , days, day
years y , years, yrs, year
  • Simply using the get_milliseconds_value_for_input with the string value to convert. The below example use the number value 90 and the sigle s.

    from env_time_converter.service.convert_service import get_milliseconds_value_for_input
    
    # Assume this ENV is set by your .yaml or other configuration file.
    os.environ['JOB_TIME'] = '90 seconds' 
    
    assert 9000 == get_milliseconds_value_for_input(os.environ['JOB_TIME'])
    
  • When the time measure unit is missing the default value is milliseconds

    from env_time_converter.service.convert_service import get_milliseconds_value_for_input
    
    assert 90 == get_milliseconds_value_for_input('90')
    

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for env-time-converter, version 0.1.6
Filename, size File type Python version Upload date Hashes
Filename, size env_time_converter-0.1.6-py3-none-any.whl (28.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size env-time-converter-0.1.6.tar.gz (26.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page