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

Uploaded Python 3

File details

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

File metadata

  • Download URL: formattimediff-0.2.7.tar.gz
  • Upload date:
  • Size: 4.1 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.7.tar.gz
Algorithm Hash digest
SHA256 732bd0314542dee48faec393cdc0ec58aa9a6f88d055301a633d76dedaafe467
MD5 fa8f7fcd8242a5b7f730d84d0443df77
BLAKE2b-256 c6cf9b178d2d54af68c10be2130528f6f66ee79cfb091ce064b5f79dfb84080b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: formattimediff-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 88c9e54d428790ffddc71989e0f060d5819f106c1bf59e2031ad68288710f3e1
MD5 1a2c2c059759509f2ee2ca4a0b8a66c6
BLAKE2b-256 385ba7ccc27b4702ec889112f2270c4709d57995b5c3bce57de1258587450981

See more details on using hashes here.

Provenance

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