Skip to content

Commit a0ceead

Browse files
committed
Some code reverted. Update CHANGELOG.md
1 parent 7e943b3 commit a0ceead

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Added
5+
- Microseconds precision for timestamps, by @HardNorth
46

57
## [5.7.2]
68
### Changed

reportportal_client/helpers/common_helpers.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
import inspect
1818
import re
1919
import threading
20+
import time
2021
import unicodedata
2122
import uuid
22-
from datetime import datetime, timezone
2323
from platform import machine, processor, system
2424
from types import MappingProxyType
2525
from typing import Any, Callable, Generic, Iterable, Optional, Sized, TypeVar, Union
@@ -32,7 +32,6 @@
3232
except ImportError:
3333
import json # type: ignore
3434

35-
ISO_MICRO_FORMAT = "%Y-%m-%dT%H:%M:%S.%f%z"
3635
_T = TypeVar("_T")
3736
ATTRIBUTE_LENGTH_LIMIT: int = 128
3837
ATTRIBUTE_NUMBER_LIMIT: int = 256
@@ -275,12 +274,9 @@ def verify_value_length(attributes: list[dict]) -> Optional[list[dict]]:
275274
return result
276275

277276

278-
def timestamp(use_microseconds=False) -> str:
279-
"""Return string representation of the current time in milli/microseconds."""
280-
now = datetime.now(tz=timezone.utc)
281-
if use_microseconds:
282-
return now.strftime(ISO_MICRO_FORMAT)
283-
return str(int(now.timestamp() * 1000))
277+
def timestamp() -> str:
278+
"""Return string representation of the current time in milliseconds."""
279+
return str(int(time.time() * 1000))
284280

285281

286282
def uri_join(*uri_parts: str) -> str:

0 commit comments

Comments
 (0)