René's URL Explorer Experiment


Title: Feature Request: ASCWriter should support configurable timestamp format (absolute vs relative) · Issue #2022 · hardbyte/python-can · GitHub

Open Graph Title: Feature Request: ASCWriter should support configurable timestamp format (absolute vs relative) · Issue #2022 · hardbyte/python-can

X Title: Feature Request: ASCWriter should support configurable timestamp format (absolute vs relative) · Issue #2022 · hardbyte/python-can

Description: Problem Description ASCWriter currently has the following issues: Header declaration doesn't match actual content: ASCWriter declares "base hex timestamps absolute" in the file header But actually writes relative timestamps (starting fro...

Open Graph Description: Problem Description ASCWriter currently has the following issues: Header declaration doesn't match actual content: ASCWriter declares "base hex timestamps absolute" in the file header But actually ...

X Description: Problem Description ASCWriter currently has the following issues: Header declaration doesn't match actual content: ASCWriter declares "base hex timestamps absolute" in the file header...

Opengraph URL: https://github.com/hardbyte/python-can/issues/2022

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature Request: ASCWriter should support configurable timestamp format (absolute vs relative)","articleBody":"\n\n## Problem Description\n\nASCWriter currently has the following issues:\n\n1. **Header declaration doesn't match actual content**:\n   - ASCWriter declares `\"base hex timestamps absolute\"` in the file header\n   - But actually writes relative timestamps (starting from 0)\n\n2. **Lack of flexibility**:\n   - No parameter to control timestamp format\n   - Users cannot choose between absolute or relative timestamp formats\n\n3. **Inconsistent with ASCReader**:\n   - ASCReader supports `relative_timestamp` parameter to control timestamp format\n   - ASCWriter lacks corresponding parameter, causing inconsistent data processing workflow\n\n## Current Behavior Example\n\n```python\n# Original ASC file may contain absolute timestamps\n# 445678.123456 1 123 Tx d 8 00 00 00 00 00 00 00 00\n\n# Reading\nreader = ASCReader('input.asc', relative_timestamp=True)  # Can control format\nmessages = list(reader)\n\n# Writing\nwriter = ASCWriter('output.asc')  # Cannot control format\nfor msg in messages:\n    writer.on_message_received(msg)\nwriter.stop()\n\n# Output file\n# Header: base hex timestamps absolute  \n# Actual content: 0.123456 1 123 Tx d 8 00 00 00 00 00 00 00 00\n```\n\n\n## Expected Behavior\n\nAdd a parameter to let ASCWriter support configurable timestamp format:\n\n```python\n# Option 1: Keep relative timestamps (default behavior, backward compatible)\nwriter = ASCWriter('output.asc', absolute_timestamps=False)  # Default value\n\n# Option 2: Use absolute timestamps  \nwriter = ASCWriter('output.asc', absolute_timestamps=True)   # New feature\n```\n\n\n## Implementation Suggestion\n\nModify ASCWriter's constructor and timestamp processing logic:\n\n```python\nclass ASCWriter(TextIOMessageWriter):\n    def __init__(\n        self,\n        file: Union[StringPathLike, TextIO],\n        channel: int = 1,\n        absolute_timestamps: bool = False,  # New parameter\n        **kwargs: Any,\n    ) -\u003e None:\n        \"\"\"\n        :param file: a path-like object or as file-like object to write to\n                     If this is a file-like object, is has to opened in text\n                     write mode, not binary write mode.\n        :param channel: a default channel to use when the message does not\n                        have a channel set\n        :param absolute_timestamps: whether to use absolute timestamps or relative \n                                   timestamps starting from 0 (default: False)\n        \"\"\"\n        # ... existing code ...\n        \n        self.absolute_timestamps = absolute_timestamps\n        # Set correct header based on parameter\n        timestamp_format = \"absolute\" if absolute_timestamps else \"relative\"\n        self.file.write(f\"base hex timestamps {timestamp_format}\\n\")\n        # ... rest of existing code ...\n\n    def log_event(self, message: str, timestamp: Optional[float] = None) -\u003e None:\n        # ... existing code ...\n        \n        # Decide whether to convert to relative timestamp based on configuration\n        if not self.absolute_timestamps and timestamp \u003e= self.started:\n            timestamp -= self.started\n        line = self.FORMAT_EVENT.format(timestamp=timestamp, message=message)\n        self.file.write(line)\n```\n\n\n## Compatibility Considerations\n\n- Default value `absolute_timestamps=False` maintains backward compatibility\n- Existing code remains unaffected\n- File header matches actual content\n\n## Additional Context\n\n- **python-can version**: 4.3.1+ (or latest version)\n- **Python version**: 3.x\n- **Operating System**: All platforms\n\nThis issue affects users who need to preserve original timestamp format, especially in data processing and analysis scenarios where absolute timestamps are important for time synchronization with other data sources.\n\nThe inconsistency between ASCReader (which supports configurable timestamp format) and ASCWriter (which doesn't) creates confusion and limits the library's usability for certain use cases.\n","author":{"url":"https://github.com/dev4ray","@type":"Person","name":"dev4ray"},"datePublished":"2026-01-18T15:39:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2022/python-can/issues/2022"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:36c63973-76f6-4c2e-e4dc-090f7b316df6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id86FC:116E4B:3C5F1E3:4F077C0:6A5D1751
html-safe-nonce81ec547e6f0945ccf9bcafd250c7018912d9457f1d834bd25e2561637b4fb779
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkZDOjExNkU0QjozQzVGMUUzOjRGMDc3QzA6NkE1RDE3NTEiLCJ2aXNpdG9yX2lkIjoiODkyMjMyNjgxMTUxNjE0NzUzOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac2a385abd8c45d2b756b29caaf8ce499746f8467068d3b278d8e2be1a958515df
hovercard-subject-tagissue:3826926262
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/hardbyte/python-can/2022/issue_layout
twitter:imagehttps://opengraph.githubassets.com/703de8c3b275e0726ffb03e370cef02e6683eddc7d2ba5332cdda5f7efbdb8a7/hardbyte/python-can/issues/2022
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/703de8c3b275e0726ffb03e370cef02e6683eddc7d2ba5332cdda5f7efbdb8a7/hardbyte/python-can/issues/2022
og:image:altProblem Description ASCWriter currently has the following issues: Header declaration doesn't match actual content: ASCWriter declares "base hex timestamps absolute" in the file header But actually ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedev4ray
hostnamegithub.com
expected-hostnamegithub.com
None5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b
turbo-cache-controlno-preview
go-importgithub.com/hardbyte/python-can git https://github.com/hardbyte/python-can.git
octolytics-dimension-user_id855189
octolytics-dimension-user_loginhardbyte
octolytics-dimension-repository_id69090889
octolytics-dimension-repository_nwohardbyte/python-can
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id69090889
octolytics-dimension-repository_network_root_nwohardbyte/python-can
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9c975978430e9ad293956f2bbdaf153b1bd84a99
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/hardbyte/python-can/issues/2022#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fhardbyte%2Fpython-can%2Fissues%2F2022
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fhardbyte%2Fpython-can%2Fissues%2F2022
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=hardbyte%2Fpython-can
Reloadhttps://github.com/hardbyte/python-can/issues/2022
Reloadhttps://github.com/hardbyte/python-can/issues/2022
Reloadhttps://github.com/hardbyte/python-can/issues/2022
hardbyte https://github.com/hardbyte
python-canhttps://github.com/hardbyte/python-can
Notifications https://github.com/login?return_to=%2Fhardbyte%2Fpython-can
Fork 687 https://github.com/login?return_to=%2Fhardbyte%2Fpython-can
Star 1.6k https://github.com/login?return_to=%2Fhardbyte%2Fpython-can
Code https://github.com/hardbyte/python-can
Issues 224 https://github.com/hardbyte/python-can/issues
Pull requests 35 https://github.com/hardbyte/python-can/pulls
Discussions https://github.com/hardbyte/python-can/discussions
Actions https://github.com/hardbyte/python-can/actions
Security and quality 0 https://github.com/hardbyte/python-can/security
Insights https://github.com/hardbyte/python-can/pulse
Code https://github.com/hardbyte/python-can
Issues https://github.com/hardbyte/python-can/issues
Pull requests https://github.com/hardbyte/python-can/pulls
Discussions https://github.com/hardbyte/python-can/discussions
Actions https://github.com/hardbyte/python-can/actions
Security and quality https://github.com/hardbyte/python-can/security
Insights https://github.com/hardbyte/python-can/pulse
#2032https://github.com/hardbyte/python-can/pull/2032
Feature Request: ASCWriter should support configurable timestamp format (absolute vs relative)https://github.com/hardbyte/python-can/issues/2022#top
#2032https://github.com/hardbyte/python-can/pull/2032
enhancementhttps://github.com/hardbyte/python-can/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/dev4ray
dev4rayhttps://github.com/dev4ray
on Jan 18, 2026https://github.com/hardbyte/python-can/issues/2022#issue-3826926262
enhancementhttps://github.com/hardbyte/python-can/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.