Skip to main content

Simple quick formatting of time differences

Project description

FormatTimeDiff

version MIT License

Simply accepts a Start Time and End Time variables created with datetime.now(), calculates the time difference, then outputs a nicely formatted output to use with print() statements with the seconds rounded up for half seconds and greater, down for under half seconds.

This can be useful for scripts that you run manually and want to keep track of how long certain actions take, but also want to have more elegant output to quickly reference.

This is my first personal project to understand how creating and deploying modules work mostly. Overall it's very simplistic and "purpose-made" for my personal use across projects, and originally created as just a basic run-of-the-mill definition I used frequently. I figured someone might get some use out of it, and it may open the gates for me to start building more broader modules down the road.

Table of Contents

Installation

On macOS and Linux:

$ python -m pip install formattimediff

On Windows:

PS> python -m pip install formattimediff

Execution / Usage

Here are a few examples of using the formattimediff library in your code:

from formattimediff import formattimediff as ftd

processStart = datetime.now()
print("Start Time:", processStart)
### do some work here ###
### or, to test, run a time.sleep(10.7) to simulate a workload ###
delta = datetime.now()
print("End Time:",delta)

timeElapsed = ftd.(processStart, delta)
print("Time Elapsed:",timeElapsed)

#Output: 
#Time Elapsed: 0 Hours, 0 Minutes, 11 Seconds
...

Technologies

formattimediff uses the following technologies and tools:

Features

It's really just the one thing it does, no additional features.

Possible formatting options in the future? Who knows?

Contributing

To contribute to the development of formattimediff, follow the steps below:

  1. Fork < project's name > from https://github.com/Datascripter/FormatTimeDiff/fork
  2. Create your feature branch (git checkout -b feature-new)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add some new feature')
  5. Push to the branch (git push origin feature-new)
  6. Create a new pull request

Contributors

Me and only me. I am fresh on the Python bandwagon too...

Author

Cody Walls - "Datascripter" https://github.com/Datascripter/FormatTimeDiff/fork

Change log

  • 0.2.5
    • Project creation for GitHub and releasing into the wild
  • 0.1.0
    • First working version
  • ...

License

formattimediff is distributed under the MIT license. See LICENSE for more details.

Project details


Download files

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

Source Distribution

formattimediff-0.2.6.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

formattimediff-0.2.6-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file formattimediff-0.2.6.tar.gz.

File metadata

  • Download URL: formattimediff-0.2.6.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for formattimediff-0.2.6.tar.gz
Algorithm Hash digest
SHA256 fef716a2e9bdc5debc887058fad7415c55431debaa788b58dadebc8cb9b775b3
MD5 a672874afdd8a952c4120306dcc04a73
BLAKE2b-256 8e96a7b3c9ba9834f494d124c8acb7bfcadfa8c57265a553aef0a600c5adec9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for formattimediff-0.2.6.tar.gz:

Publisher: python-publish.yml on Datascripter/FormatTimeDiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file formattimediff-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: formattimediff-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for formattimediff-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 25c3a0765b83f9c3a2fcb347558df6ec5a8ebb2dcbb8efae254ea62b287b5a1b
MD5 b993f1b9fd37538d2c0d5446fb10eb68
BLAKE2b-256 9e34b0adf8c80223fa2c29b783f08bbea464eb15de83e514627a0ca801f5eee2

See more details on using hashes here.

Provenance

The following attestation bundles were made for formattimediff-0.2.6-py3-none-any.whl:

Publisher: python-publish.yml on Datascripter/FormatTimeDiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page