Skip to main content

time_utils

Basic python package to time processes similar to a stopwatch. This package also includes various pre-formated timestamps for sql, s3 key prefixes, and s3 glues prefixes.

stopWatch

A class intended to minimic the functionality of a stop watch. The lap function will return a human readable string of how much total time was elapsed as well as the lap time.

basic usage:

>>> from time_utils import time_utils as tu
>>> sw = tu.stopWatch()
>>> sw.lap()
Total Time:
4 second(s)

Lap 1:
4 second(s)

datetime.timedelta(seconds=4, microseconds=218298)
>>> sw.lap()
Total Time:
15 second(s)

Lap 2:
11 second(s)

datetime.timedelta(seconds=11, microseconds=440822)

preformatted datetime outputs

All functions default to utcnow(), however a datetime object can be passed in to any function.

ts_dict

>>> tu.time_utils.ts_dict()
{
'year': '2019', 
'month': '12', 
'day': '29', 
'hour': '00', 
'min': '24', 
'sec': '43'
}

sql_ts

>>> tu.time_utils.sql_ts()
'2019-12-29 00:25:00'

s3_ts

>>> tu.time_utils.s3_ts()
'/2019/12/29/'

s3_glue_ts

>>> tu.time_utils.s3_glue_ts()
'/year=2019/month=12/day=29/'

Release files for time-utils 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for time-utils 1.0.1
File Size Uploaded
time_utils-1.0.1.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for time-utils 1.0.1
File Interpreter ABI Platform
time_utils-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / time_utils-1.0.1.tar.gz

Download URL time_utils-1.0.1.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
62fbd7f680dabfe5aa97af710e62eb7993673dea5448a86a086c40d434823bf8
BLAKE2b-256 checksum
How to use checksums
c4a0ee62c952c6a0b7d0b33294ca4688653f65ff1d7f0bcf14eb1df740057aad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.41.0 CPython/3.7.5

Release files / time_utils-1.0.1-py3-none-any.whl

Download URL time_utils-1.0.1-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
119550e8b53dc87187334b6b01f6c43136caed2f25044c3d40414370b979404b
BLAKE2b-256 checksum
How to use checksums
5a1fc8f75e96a1f8eff91201afc6ebbf47a2cf1d25ce52e79ab054f5bf4a614d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.41.0 CPython/3.7.5

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page