Skip to content

refactor: replace sec2us and us2sec to seconds2microseconds and microseconds2seconds#230

Merged
ktro2828 merged 2 commits into
mainfrom
refactor/common/timestamp
Nov 19, 2025
Merged

refactor: replace sec2us and us2sec to seconds2microseconds and microseconds2seconds#230
ktro2828 merged 2 commits into
mainfrom
refactor/common/timestamp

Conversation

@ktro2828

Copy link
Copy Markdown
Collaborator

What

This pull request refactors and modernizes the timestamp conversion utilities across the codebase. It introduces new, clearly named functions (microseconds2seconds and seconds2microseconds) to replace the older us2sec and sec2us functions, which are now marked as deprecated. All usages throughout the project have been updated to use the new functions, improving code readability and future maintainability.

Timestamp utility modernization:

  • Added new functions: microseconds2seconds (converts microseconds to seconds) and seconds2microseconds (converts seconds to microseconds) in t4_devkit/common/timestamp.py. Updated __all__ to only export these new functions.
  • Marked the old us2sec and sec2us functions as deprecated using the @deprecated decorator, and updated their implementations to call the new functions.

Codebase-wide updates:

  • Replaced all imports and usages of us2sec and sec2us with microseconds2seconds and seconds2microseconds in t4_devkit/helper/rendering.py, t4_devkit/helper/timeseries.py, and t4_devkit/viewer/viewer.py. [1] [2] [3]
  • Updated all function calls throughout the codebase to use the new timestamp functions, ensuring consistency and removing reliance on deprecated utilities. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Testing:

  • Updated tests/common/test_timestamp.py to use the new timestamp conversion functions, ensuring tests reflect the updated API.

…seconds2seconds

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Copilot AI review requested due to automatic review settings November 18, 2025 13:16
@github-actions github-actions Bot added ci Continuous Integration (CI) processes and testing refactor Refactoring code or increasing performance labels Nov 18, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors timestamp conversion utilities by introducing clearly named functions microseconds2seconds and seconds2microseconds to replace the abbreviated us2sec and sec2us functions. The old functions are deprecated but retained for backward compatibility, while all internal usages have been migrated to the new naming convention.

Key changes:

  • New timestamp conversion functions with descriptive names added to t4_devkit/common/timestamp.py
  • Old us2sec and sec2us functions marked as deprecated using @deprecated decorator
  • All imports and function calls updated across the codebase to use new function names

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
t4_devkit/common/timestamp.py Added new microseconds2seconds and seconds2microseconds functions; deprecated old us2sec and sec2us functions
t4_devkit/helper/rendering.py Updated imports and all function calls to use new timestamp conversion functions
t4_devkit/helper/timeseries.py Updated imports and function calls to use microseconds2seconds
t4_devkit/viewer/viewer.py Updated import and function call to use microseconds2seconds
tests/common/test_timestamp.py Updated test to import and use new timestamp conversion functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread t4_devkit/common/timestamp.py Outdated
Comment thread t4_devkit/common/timestamp.py Outdated
@github-actions

github-actions Bot commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ❌

Overall Coverage

Lines Covered Coverage Threshold Status
3963 3259 82% 50% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
t4_devkit/common/timestamp.py 85% 🟢
t4_devkit/helper/rendering.py 15% 🔴
t4_devkit/helper/timeseries.py 27% 🔴
t4_devkit/viewer/viewer.py 87% 🟢
TOTAL 53% 🔴

updated for commit: 6f62e7d by action🐍

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
@ktro2828 ktro2828 merged commit 492dbbb into main Nov 19, 2025
4 of 6 checks passed
@ktro2828 ktro2828 deleted the refactor/common/timestamp branch November 19, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration (CI) processes and testing refactor Refactoring code or increasing performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants