python-time-functions 2.1.2__tar.gz → 2.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_time_functions-2.1.2/src/python_time_functions.egg-info → python_time_functions-2.1.4}/PKG-INFO +8 -7
- {python_time_functions-2.1.2 → python_time_functions-2.1.4}/README.md +6 -5
- {python_time_functions-2.1.2 → python_time_functions-2.1.4}/pyproject.toml +2 -2
- {python_time_functions-2.1.2 → python_time_functions-2.1.4/src/python_time_functions.egg-info}/PKG-INFO +8 -7
- {python_time_functions-2.1.2 → python_time_functions-2.1.4}/src/python_time_functions.egg-info/SOURCES.txt +2 -2
- python_time_functions-2.1.4/src/python_time_functions.egg-info/top_level.txt +1 -0
- {python_time_functions-2.1.2/src/python_time_fuctions → python_time_functions-2.1.4/src/time_functions}/time_functions.py +52 -18
- python_time_functions-2.1.4/tests/test_time_function_sanitizer.py +64 -0
- {python_time_functions-2.1.2 → python_time_functions-2.1.4}/tests/test_time_functions.py +84 -45
- python_time_functions-2.1.2/src/python_time_functions.egg-info/top_level.txt +0 -1
- python_time_functions-2.1.2/tests/test_time_function_sanitizer.py +0 -64
- {python_time_functions-2.1.2 → python_time_functions-2.1.4}/LICENSE +0 -0
- {python_time_functions-2.1.2 → python_time_functions-2.1.4}/setup.cfg +0 -0
- {python_time_functions-2.1.2 → python_time_functions-2.1.4}/src/python_time_functions.egg-info/dependency_links.txt +0 -0
- {python_time_functions-2.1.2 → python_time_functions-2.1.4}/src/python_time_functions.egg-info/requires.txt +0 -0
- {python_time_functions-2.1.2/src/python_time_fuctions → python_time_functions-2.1.4/src/time_functions}/__init__.py +0 -0
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python_time_functions
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.4
|
|
4
4
|
Summary: Common Python functions for time handling
|
|
5
5
|
Author-email: Corne Bester <corne.bester@gmail.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
6
|
Project-URL: Homepage, https://example.com
|
|
8
7
|
Project-URL: Documentation, https://readthedocs.org
|
|
9
8
|
Project-URL: Repository, https://github.com/cornebester/python_time_functions
|
|
10
9
|
Project-URL: Issues, https://github.com/cornebester/python_time_functions/issues
|
|
11
10
|
Project-URL: Changelog, https://github.com/cornebester/python_time_functions/blob/master/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: datetime
|
|
15
15
|
Requires-Dist: timezone
|
|
16
16
|
Dynamic: license-file
|
|
17
17
|
|
|
18
|
-
#
|
|
18
|
+
# Readme
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Common Python functions for time handling
|
|
21
21
|
|
|
22
|
-
```
|
|
22
|
+
```python
|
|
23
23
|
from datetime import datetime, timezone
|
|
24
|
-
|
|
25
|
-
# OR
|
|
24
|
+
|
|
26
25
|
import time_functions
|
|
26
|
+
# OR
|
|
27
|
+
from time_functions import get_timestamp_unix_millis
|
|
27
28
|
|
|
28
29
|
timestamp = datetime.now(timezone.utc)
|
|
29
30
|
unix_millis = get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Readme
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Common Python functions for time handling
|
|
4
4
|
|
|
5
|
-
```
|
|
5
|
+
```python
|
|
6
6
|
from datetime import datetime, timezone
|
|
7
|
-
|
|
8
|
-
# OR
|
|
7
|
+
|
|
9
8
|
import time_functions
|
|
9
|
+
# OR
|
|
10
|
+
from time_functions import get_timestamp_unix_millis
|
|
10
11
|
|
|
11
12
|
timestamp = datetime.now(timezone.utc)
|
|
12
13
|
unix_millis = get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
|
|
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python_time_functions"
|
|
7
|
-
version = "2.1.
|
|
7
|
+
version = "2.1.4"
|
|
8
8
|
description = "Common Python functions for time handling"
|
|
9
|
+
requires-python = ">=3.10"
|
|
9
10
|
readme = "README.md"
|
|
10
11
|
authors = [{name = "Corne Bester", email = "corne.bester@gmail.com"}]
|
|
11
12
|
dependencies = [
|
|
12
13
|
"datetime",
|
|
13
14
|
"timezone"
|
|
14
15
|
]
|
|
15
|
-
license = "MIT"
|
|
16
16
|
license-files = ["LICEN[CS]E*"]
|
|
17
17
|
|
|
18
18
|
[project.urls]
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python_time_functions
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.4
|
|
4
4
|
Summary: Common Python functions for time handling
|
|
5
5
|
Author-email: Corne Bester <corne.bester@gmail.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
6
|
Project-URL: Homepage, https://example.com
|
|
8
7
|
Project-URL: Documentation, https://readthedocs.org
|
|
9
8
|
Project-URL: Repository, https://github.com/cornebester/python_time_functions
|
|
10
9
|
Project-URL: Issues, https://github.com/cornebester/python_time_functions/issues
|
|
11
10
|
Project-URL: Changelog, https://github.com/cornebester/python_time_functions/blob/master/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: datetime
|
|
15
15
|
Requires-Dist: timezone
|
|
16
16
|
Dynamic: license-file
|
|
17
17
|
|
|
18
|
-
#
|
|
18
|
+
# Readme
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Common Python functions for time handling
|
|
21
21
|
|
|
22
|
-
```
|
|
22
|
+
```python
|
|
23
23
|
from datetime import datetime, timezone
|
|
24
|
-
|
|
25
|
-
# OR
|
|
24
|
+
|
|
26
25
|
import time_functions
|
|
26
|
+
# OR
|
|
27
|
+
from time_functions import get_timestamp_unix_millis
|
|
27
28
|
|
|
28
29
|
timestamp = datetime.now(timezone.utc)
|
|
29
30
|
unix_millis = get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
3
|
pyproject.toml
|
|
4
|
-
src/python_time_fuctions/__init__.py
|
|
5
|
-
src/python_time_fuctions/time_functions.py
|
|
6
4
|
src/python_time_functions.egg-info/PKG-INFO
|
|
7
5
|
src/python_time_functions.egg-info/SOURCES.txt
|
|
8
6
|
src/python_time_functions.egg-info/dependency_links.txt
|
|
9
7
|
src/python_time_functions.egg-info/requires.txt
|
|
10
8
|
src/python_time_functions.egg-info/top_level.txt
|
|
9
|
+
src/time_functions/__init__.py
|
|
10
|
+
src/time_functions/time_functions.py
|
|
11
11
|
tests/test_time_function_sanitizer.py
|
|
12
12
|
tests/test_time_functions.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
time_functions
|
|
@@ -239,7 +239,7 @@ def timestamp_parser_psql_millis(timestamp):
|
|
|
239
239
|
|
|
240
240
|
|
|
241
241
|
def timestamp_sanitizer_psql(input):
|
|
242
|
-
|
|
242
|
+
"""
|
|
243
243
|
Normalize unix timestamps to postgresl friendly float with millisecond decimals. 14 digits
|
|
244
244
|
Attemps to fix/sanitize bad timestamp format I dreamed up like
|
|
245
245
|
>>> time_functions.timestamp_sanitizer_psql(1729755232184)
|
|
@@ -250,53 +250,87 @@ def timestamp_sanitizer_psql(input):
|
|
|
250
250
|
1729765228.327
|
|
251
251
|
handle timestamp as:
|
|
252
252
|
unix micros or millis in decimal format
|
|
253
|
-
unix millis or micros in unix format
|
|
253
|
+
unix millis or micros in unix format
|
|
254
254
|
iso8601
|
|
255
|
-
|
|
255
|
+
"""
|
|
256
256
|
try:
|
|
257
257
|
if isinstance(input, int):
|
|
258
258
|
if len(str(input)) == 10:
|
|
259
259
|
logger.debug("Not millsecond precision: %s", input)
|
|
260
260
|
return input
|
|
261
261
|
elif len(str(input)) == 13:
|
|
262
|
-
normalized = str((input/1000))[:14]
|
|
263
|
-
logger.debug(
|
|
262
|
+
normalized = str((input / 1000))[:14]
|
|
263
|
+
logger.debug(
|
|
264
|
+
"Normalizing timestamp for postgresql from %s to %s",
|
|
265
|
+
input,
|
|
266
|
+
normalized,
|
|
267
|
+
)
|
|
264
268
|
return float(normalized)
|
|
265
269
|
elif len(str(input)) == 16:
|
|
266
|
-
normalized = str(input/1000000)[:14]
|
|
267
|
-
logger.debug(
|
|
270
|
+
normalized = str(input / 1000000)[:14]
|
|
271
|
+
logger.debug(
|
|
272
|
+
"Normalizing timestamp for postgresql from %s to %s",
|
|
273
|
+
input,
|
|
274
|
+
normalized,
|
|
275
|
+
)
|
|
268
276
|
return float(normalized)
|
|
269
277
|
elif isinstance(input, float):
|
|
270
278
|
# elif '.' in str(input):
|
|
271
|
-
decimal_index = str.index(str(input),
|
|
279
|
+
decimal_index = str.index(str(input), ".")
|
|
272
280
|
if decimal_index == 13:
|
|
273
|
-
normalized = str(input/1000)[:14] # remove microsecond precision
|
|
274
|
-
logger.debug(
|
|
281
|
+
normalized = str(input / 1000)[:14] # remove microsecond precision
|
|
282
|
+
logger.debug(
|
|
283
|
+
"Normalizing timestamp for postgresql from %s to %s",
|
|
284
|
+
input,
|
|
285
|
+
normalized,
|
|
286
|
+
)
|
|
275
287
|
return float(normalized)
|
|
276
288
|
elif decimal_index == 10:
|
|
277
289
|
normalized = str(input)[:14] # remove microsecond precision
|
|
278
|
-
logger.debug(
|
|
290
|
+
logger.debug(
|
|
291
|
+
"Normalizing timestamp for postgresql from %s to %s",
|
|
292
|
+
input,
|
|
293
|
+
normalized,
|
|
294
|
+
)
|
|
279
295
|
return float(normalized)
|
|
280
296
|
elif isinstance(input, str):
|
|
281
297
|
if len(input) == 20:
|
|
282
298
|
obj_from_iso = convert_iso_string_to_datetime_obj(input)
|
|
283
|
-
unix_with_subseconds = get_timestamp_unix_subseconds_decimal(
|
|
299
|
+
unix_with_subseconds = get_timestamp_unix_subseconds_decimal(
|
|
300
|
+
obj_from_iso
|
|
301
|
+
)
|
|
284
302
|
normalized = unix_with_subseconds
|
|
285
|
-
logger.debug(
|
|
303
|
+
logger.debug(
|
|
304
|
+
"Normalizing timestamp for postgresql from %s to %s",
|
|
305
|
+
input,
|
|
306
|
+
normalized,
|
|
307
|
+
)
|
|
286
308
|
return float(normalized)
|
|
287
309
|
if len(input) == 24:
|
|
288
310
|
obj_from_iso = convert_iso_string_to_datetime_obj(input)
|
|
289
|
-
unix_with_subseconds = get_timestamp_unix_subseconds_decimal(
|
|
311
|
+
unix_with_subseconds = get_timestamp_unix_subseconds_decimal(
|
|
312
|
+
obj_from_iso
|
|
313
|
+
)
|
|
290
314
|
normalized = unix_with_subseconds
|
|
291
|
-
logger.debug(
|
|
315
|
+
logger.debug(
|
|
316
|
+
"Normalizing timestamp for postgresql from %s to %s",
|
|
317
|
+
input,
|
|
318
|
+
normalized,
|
|
319
|
+
)
|
|
292
320
|
return float(normalized)
|
|
293
321
|
elif len(input) == 27:
|
|
294
322
|
obj_from_iso = convert_iso_string_to_datetime_obj(input)
|
|
295
|
-
unix_with_subseconds = get_timestamp_unix_subseconds_decimal(
|
|
323
|
+
unix_with_subseconds = get_timestamp_unix_subseconds_decimal(
|
|
324
|
+
obj_from_iso
|
|
325
|
+
)
|
|
296
326
|
normalized = str(unix_with_subseconds)[:14]
|
|
297
|
-
logger.debug(
|
|
327
|
+
logger.debug(
|
|
328
|
+
"Normalizing timestamp for postgresql from %s to %s",
|
|
329
|
+
input,
|
|
330
|
+
normalized,
|
|
331
|
+
)
|
|
298
332
|
return float(normalized)
|
|
299
333
|
else:
|
|
300
334
|
logger.error("Unexcpected timestamp format")
|
|
301
335
|
except Exception as msg:
|
|
302
|
-
logger.exception(msg)
|
|
336
|
+
logger.exception(msg)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import src.time_functions.time_functions as time_functions
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_convertions_from_sample24():
|
|
5
|
+
"""
|
|
6
|
+
# unix seconds
|
|
7
|
+
"""
|
|
8
|
+
assert time_functions.timestamp_sanitizer_psql(1742758997) == 1742758997
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_convertions_from_sample25():
|
|
12
|
+
"""
|
|
13
|
+
# unix millis
|
|
14
|
+
"""
|
|
15
|
+
assert time_functions.timestamp_sanitizer_psql(1742758997018) == 1742758997.018
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_convertions_from_sample26():
|
|
19
|
+
"""
|
|
20
|
+
# unix micros
|
|
21
|
+
"""
|
|
22
|
+
assert time_functions.timestamp_sanitizer_psql(1742758997018308) == 1742758997.018
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_convertions_from_sample27():
|
|
26
|
+
"""
|
|
27
|
+
# unix micros
|
|
28
|
+
"""
|
|
29
|
+
assert time_functions.timestamp_sanitizer_psql(1742758997018308) == 1742758997.018
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_convertions_from_sample28():
|
|
33
|
+
"""
|
|
34
|
+
# psql special
|
|
35
|
+
"""
|
|
36
|
+
assert time_functions.timestamp_sanitizer_psql(1742758997.018308) == 1742758997.018
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_convertions_from_sample29():
|
|
40
|
+
"""
|
|
41
|
+
# psql special
|
|
42
|
+
"""
|
|
43
|
+
assert time_functions.timestamp_sanitizer_psql(1742758997.018) == 1742758997.018
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_convertions_from_sample30():
|
|
47
|
+
"""
|
|
48
|
+
# bad format
|
|
49
|
+
"""
|
|
50
|
+
assert time_functions.timestamp_sanitizer_psql(1742758997018.308) == 1742758997.018
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_convertions_from_sample31():
|
|
54
|
+
"""
|
|
55
|
+
# bad format
|
|
56
|
+
"""
|
|
57
|
+
assert (
|
|
58
|
+
time_functions.timestamp_sanitizer_psql("2025-03-23T19:43:17.018Z")
|
|
59
|
+
== 1742758997.018
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_convertions_from_sample32():
|
|
64
|
+
assert time_functions.timestamp_sanitizer_psql(1742742625002.908) == 1742742625.002
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import logging
|
|
2
1
|
from datetime import datetime, timezone
|
|
3
|
-
import src.
|
|
2
|
+
import src.time_functions.time_functions as time_functions
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
new_obj = datetime.now(timezone.utc)
|
|
@@ -24,33 +23,53 @@ obj_from_unix_seconds = time_functions.convert_unix_to_datetime_obj(unix)
|
|
|
24
23
|
obj_from_unix_milliseconds = time_functions.convert_unix_to_datetime_obj(unix_millis)
|
|
25
24
|
obj_from_unix_microseconds = time_functions.convert_unix_to_datetime_obj(unix_micros)
|
|
26
25
|
|
|
27
|
-
obj_from_unix_seconds_float_millis = time_functions.convert_unix_to_datetime_obj(
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
obj_from_unix_seconds_float_millis = time_functions.convert_unix_to_datetime_obj(
|
|
27
|
+
unix_millis / 1000
|
|
28
|
+
)
|
|
29
|
+
obj_from_unix_seconds_float_micros = time_functions.convert_unix_to_datetime_obj(
|
|
30
|
+
unix_micros / 1000000
|
|
31
|
+
)
|
|
32
|
+
obj_from_unix_seconds_float = time_functions.convert_unix_to_datetime_obj(
|
|
33
|
+
unix_with_subseconds
|
|
34
|
+
)
|
|
30
35
|
|
|
31
36
|
|
|
32
37
|
def test_convertions_from_sample():
|
|
33
|
-
assert time_functions.convert_unix_to_datetime_obj(
|
|
38
|
+
assert time_functions.convert_unix_to_datetime_obj(
|
|
39
|
+
1742736574
|
|
40
|
+
) == time_functions.convert_iso_string_to_datetime_obj("2025-03-23T13:29:34+00:00")
|
|
34
41
|
|
|
35
42
|
|
|
36
43
|
def test_convertions_from_sample2():
|
|
37
|
-
assert time_functions.convert_unix_to_datetime_obj(
|
|
44
|
+
assert time_functions.convert_unix_to_datetime_obj(
|
|
45
|
+
1742737159020
|
|
46
|
+
) == time_functions.convert_iso_string_to_datetime_obj("2025-03-23T13:39:19.020Z")
|
|
38
47
|
|
|
39
48
|
|
|
40
49
|
def test_convertions_from_sample3():
|
|
41
|
-
assert time_functions.convert_unix_to_datetime_obj(
|
|
50
|
+
assert time_functions.convert_unix_to_datetime_obj(
|
|
51
|
+
1742737771434946
|
|
52
|
+
) == time_functions.convert_iso_string_to_datetime_obj(
|
|
53
|
+
"2025-03-23T13:49:31.434946Z"
|
|
54
|
+
)
|
|
42
55
|
|
|
43
56
|
|
|
44
57
|
def test_convertions_from_sample4():
|
|
45
|
-
assert time_functions.convert_unix_to_datetime_obj(
|
|
58
|
+
assert time_functions.convert_unix_to_datetime_obj(
|
|
59
|
+
unix
|
|
60
|
+
) == time_functions.convert_iso_string_to_datetime_obj(iso)
|
|
46
61
|
|
|
47
62
|
|
|
48
63
|
def test_convertions_from_sample5():
|
|
49
|
-
assert time_functions.convert_unix_to_datetime_obj(
|
|
64
|
+
assert time_functions.convert_unix_to_datetime_obj(
|
|
65
|
+
unix_millis
|
|
66
|
+
) == time_functions.convert_iso_string_to_datetime_obj(iso_millis)
|
|
50
67
|
|
|
51
68
|
|
|
52
69
|
def test_convertions_from_sample6():
|
|
53
|
-
assert time_functions.convert_unix_to_datetime_obj(
|
|
70
|
+
assert time_functions.convert_unix_to_datetime_obj(
|
|
71
|
+
unix_micros
|
|
72
|
+
) == time_functions.convert_iso_string_to_datetime_obj(iso_micros)
|
|
54
73
|
|
|
55
74
|
|
|
56
75
|
def test_convertions_from_sample7():
|
|
@@ -78,34 +97,45 @@ def test_convertions_from_sample12():
|
|
|
78
97
|
|
|
79
98
|
|
|
80
99
|
def test_convertions_from_sample13():
|
|
81
|
-
assert time_functions.convert_unix_to_datetime_obj(
|
|
100
|
+
assert time_functions.convert_unix_to_datetime_obj(
|
|
101
|
+
unix_with_subseconds
|
|
102
|
+
) == time_functions.convert_iso_string_to_datetime_obj(iso_micros)
|
|
82
103
|
|
|
83
104
|
|
|
84
105
|
def test_convertions_from_sample14():
|
|
85
|
-
|
|
106
|
+
"""
|
|
86
107
|
# obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25Z")
|
|
87
108
|
# unix_with_subseconds = int(time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso))
|
|
88
109
|
# unix_with_subseconds == 1742742625
|
|
89
|
-
|
|
90
|
-
assert
|
|
110
|
+
"""
|
|
111
|
+
assert (
|
|
112
|
+
time_functions.timestamp_parser_psql_millis("2025-03-23T15:10:25Z")
|
|
113
|
+
== 1742742625
|
|
114
|
+
)
|
|
91
115
|
|
|
92
116
|
|
|
93
117
|
def test_convertions_from_sample15():
|
|
94
|
-
|
|
118
|
+
"""
|
|
95
119
|
# obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25.002Z")
|
|
96
120
|
# unix_with_subseconds = time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso)
|
|
97
121
|
# unix_with_subseconds == 1742742625.002
|
|
98
|
-
|
|
99
|
-
assert
|
|
122
|
+
"""
|
|
123
|
+
assert (
|
|
124
|
+
time_functions.timestamp_parser_psql_millis("2025-03-23T15:10:25.002Z")
|
|
125
|
+
== 1742742625.002
|
|
126
|
+
)
|
|
100
127
|
|
|
101
128
|
|
|
102
129
|
def test_convertions_from_sample16():
|
|
103
|
-
|
|
130
|
+
"""
|
|
104
131
|
# obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25.002908Z")
|
|
105
132
|
# unix_with_subseconds = time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso)
|
|
106
133
|
# unix_with_subseconds == 1742742625.002908
|
|
107
|
-
|
|
108
|
-
assert
|
|
134
|
+
"""
|
|
135
|
+
assert (
|
|
136
|
+
time_functions.timestamp_parser_psql_millis("2025-03-23T15:10:25.002908Z")
|
|
137
|
+
== 1742742625.002
|
|
138
|
+
)
|
|
109
139
|
|
|
110
140
|
|
|
111
141
|
def test_convertions_from_sample17():
|
|
@@ -113,68 +143,77 @@ def test_convertions_from_sample17():
|
|
|
113
143
|
|
|
114
144
|
|
|
115
145
|
def test_convertions_from_sample18():
|
|
116
|
-
|
|
146
|
+
"""
|
|
117
147
|
postgresql timeformat
|
|
118
|
-
|
|
148
|
+
"""
|
|
119
149
|
assert time_functions.timestamp_parser_psql_millis(1742742625.0) == 1742742625.0
|
|
120
150
|
|
|
121
151
|
|
|
122
152
|
def test_convertions_from_sample19():
|
|
123
|
-
|
|
153
|
+
"""
|
|
124
154
|
postgresql timeformat
|
|
125
|
-
|
|
155
|
+
"""
|
|
126
156
|
assert time_functions.timestamp_parser_psql_millis(1742742625.002) == 1742742625.002
|
|
127
157
|
|
|
128
158
|
|
|
129
159
|
def test_convertions_from_sample20():
|
|
130
|
-
|
|
160
|
+
"""
|
|
131
161
|
postgresql timeformat
|
|
132
|
-
|
|
133
|
-
assert
|
|
162
|
+
"""
|
|
163
|
+
assert (
|
|
164
|
+
time_functions.timestamp_parser_psql_millis(1742742625.002908) == 1742742625.002
|
|
165
|
+
)
|
|
134
166
|
|
|
135
167
|
|
|
136
168
|
def test_convertions_from_sample21():
|
|
137
|
-
|
|
169
|
+
"""
|
|
138
170
|
python millis timeformat
|
|
139
|
-
|
|
171
|
+
"""
|
|
140
172
|
assert time_functions.timestamp_parser_psql_millis(1742742625002) == 1742742625.002
|
|
141
173
|
|
|
142
174
|
|
|
143
175
|
def test_convertions_from_sample22():
|
|
144
|
-
|
|
176
|
+
"""
|
|
145
177
|
python micros timeformat
|
|
146
|
-
|
|
147
|
-
assert
|
|
178
|
+
"""
|
|
179
|
+
assert (
|
|
180
|
+
time_functions.timestamp_parser_psql_millis(1742742625002908) == 1742742625.002
|
|
181
|
+
)
|
|
182
|
+
|
|
148
183
|
|
|
149
184
|
def test_convertions_from_sample33():
|
|
150
|
-
|
|
185
|
+
"""
|
|
151
186
|
postgresql nano timeformat
|
|
152
|
-
|
|
153
|
-
assert
|
|
187
|
+
"""
|
|
188
|
+
assert (
|
|
189
|
+
time_functions.timestamp_parser_psql_millis(1742742625.002908123)
|
|
190
|
+
== 1742742625.002
|
|
191
|
+
)
|
|
154
192
|
|
|
155
193
|
|
|
156
194
|
def test_convertions_from_sample32():
|
|
157
|
-
|
|
195
|
+
"""
|
|
158
196
|
bad timeformat
|
|
159
|
-
|
|
197
|
+
"""
|
|
160
198
|
assert time_functions.timestamp_parser_psql_millis(1742742625002.908) is None
|
|
161
199
|
|
|
162
200
|
|
|
163
201
|
def test_convertions_from_sample34():
|
|
164
|
-
|
|
202
|
+
"""
|
|
165
203
|
bad timeformat
|
|
166
|
-
|
|
204
|
+
"""
|
|
167
205
|
assert time_functions.timestamp_sanitizer_psql(1729755232184) == 1729755232.184
|
|
168
206
|
|
|
207
|
+
|
|
169
208
|
def test_convertions_from_sample35():
|
|
170
|
-
|
|
209
|
+
"""
|
|
171
210
|
bad timeformat
|
|
172
|
-
|
|
211
|
+
"""
|
|
173
212
|
assert time_functions.timestamp_sanitizer_psql(1729765227856.3) == 1729765227.856
|
|
174
213
|
|
|
175
214
|
|
|
176
215
|
def test_convertions_from_sample36():
|
|
177
|
-
|
|
216
|
+
"""
|
|
178
217
|
bad timeformat
|
|
179
|
-
|
|
180
|
-
assert time_functions.timestamp_sanitizer_psql(1729765228327.051) == 1729765228.327
|
|
218
|
+
"""
|
|
219
|
+
assert time_functions.timestamp_sanitizer_psql(1729765228327.051) == 1729765228.327
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
python_time_fuctions
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import src.python_time_fuctions.time_functions as time_functions
|
|
2
|
-
|
|
3
|
-
def test_convertions_from_sample23():
|
|
4
|
-
assert float(time_functions.timestamp_sanitizer_psql(1742758997)) == 1742758997
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def test_convertions_from_sample24():
|
|
8
|
-
'''
|
|
9
|
-
# unix seconds
|
|
10
|
-
'''
|
|
11
|
-
assert int(time_functions.timestamp_sanitizer_psql(1742758997)) == 1742758997
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def test_convertions_from_sample25():
|
|
15
|
-
'''
|
|
16
|
-
# unix millis
|
|
17
|
-
'''
|
|
18
|
-
assert float(time_functions.timestamp_sanitizer_psql(1742758997018)) == 1742758997.018
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def test_convertions_from_sample26():
|
|
22
|
-
'''
|
|
23
|
-
# unix micros
|
|
24
|
-
'''
|
|
25
|
-
assert float(time_functions.timestamp_sanitizer_psql(1742758997018308)) == 1742758997.018
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_convertions_from_sample27():
|
|
29
|
-
'''
|
|
30
|
-
# unix micros
|
|
31
|
-
'''
|
|
32
|
-
assert float(time_functions.timestamp_sanitizer_psql(1742758997018308)) == 1742758997.018
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def test_convertions_from_sample28():
|
|
36
|
-
'''
|
|
37
|
-
# psql special
|
|
38
|
-
'''
|
|
39
|
-
assert float(time_functions.timestamp_sanitizer_psql(1742758997.018308)) == 1742758997.018
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def test_convertions_from_sample29():
|
|
43
|
-
'''
|
|
44
|
-
# psql special
|
|
45
|
-
'''
|
|
46
|
-
assert float(time_functions.timestamp_sanitizer_psql(1742758997.018)) == 1742758997.018
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def test_convertions_from_sample30():
|
|
50
|
-
'''
|
|
51
|
-
# bad format
|
|
52
|
-
'''
|
|
53
|
-
assert float(time_functions.timestamp_sanitizer_psql(1742758997018.308)) == 1742758997.018
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def test_convertions_from_sample31():
|
|
57
|
-
'''
|
|
58
|
-
# bad format
|
|
59
|
-
'''
|
|
60
|
-
assert float(time_functions.timestamp_sanitizer_psql("2025-03-23T19:43:17.018Z")) == 1742758997.018
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def test_convertions_from_sample32():
|
|
64
|
-
assert time_functions.timestamp_sanitizer_psql(1742742625002.908) == 1742742625.002
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|