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.5.tar.gz (4.0 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.5-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: formattimediff-0.2.5.tar.gz
  • Upload date:
  • Size: 4.0 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.5.tar.gz
Algorithm Hash digest
SHA256 d370d6bf05074033f7a07c7f481765c52bfcf41ffb37361340442acb11674dcc
MD5 ff36f7dd7fe7d12ddc475ad3277c8f21
BLAKE2b-256 1e779470e0a4c3fac18e0328d503c02c80227adb6b25b6c4966b7009a876fddb

See more details on using hashes here.

Provenance

The following attestation bundles were made for formattimediff-0.2.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: formattimediff-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bcae76916e674f71e6f3a1ec6ef50a964b5fe09456dca169f13c8d199fb0b94a
MD5 bc50d7f5244d5ee8b36c7795728e13a8
BLAKE2b-256 ba7600648c32431e1d3125c14fdc214cd19a340f9a6f2bd76bc47029deb25dd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for formattimediff-0.2.5-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