Skip to content

Logged .asc file can't open in CANoe 14 #1315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tienlocnguyen opened this issue May 23, 2022 · 2 comments · Fixed by #1362
Closed

Logged .asc file can't open in CANoe 14 #1315

tienlocnguyen opened this issue May 23, 2022 · 2 comments · Fixed by #1362
Labels

Comments

@tienlocnguyen
Copy link

tienlocnguyen commented May 23, 2022

Describe the bug

Logged .asc file by python-can is not able to open in CANoe 14

To Reproduce

  • Record .asc file by python-can
  • Try to replay logged file by CANoe 14

Expected behavior

Can replay log by CANoe 14

Additional context

OS and version: Window 10
Python version: 3.8
python-can version: 4.0.0(https://github.com/hardbyte/python-can/releases/download/4.0.0/python_can-4.0.0-py3-none-any.whl)
python-can interface/s (if applicable):

Root cause

Date information in header of .asc file contain 6 digits of milisecond and somehow violate CANoe 14 rule. 3 digits is accepted
Not work: date Mon May 23 03:29:03.103xxx PM 2022
Worked: date Mon May 23 03:29:03.103 PM 2022

Propose fix

Use same logic to get datetime when write begin trigger block
File asc.py, line 368-369
Change from

        now = datetime.now().strftime(self.FORMAT_START_OF_FILE_DATE)
        self.file.write(f"date {now}\n")

to

        now = datetime.now().timestamp()
        mlsec = repr(now).split(".")[1][:-3]
        formatted_date = time.strftime(
            self.FORMAT_DATE.format(mlsec), time.localtime(now)
        )
        self.file.write(f"date {formatted_date}\n")

Tested and can open in CANoe

@zariiii9003
Copy link
Collaborator

Would you like to create a PR?

@Tian-Jionglu
Copy link

Thanks to @tienlocnguyen , this solution solved my issue.
I created a PR #1357 to fix this issue. Sightly difference, since can_logconvert should also be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants