Skip to content

SFTP Timestamp incorrect for FATFS #975

Closed

Description

@J-Goldacker

wolfssh/src/wolfsftp.c

Lines 4958 to 4959 in 6e69959

atr->atime = info.ftime;
atr->mtime = info.ftime;

The problem is here. FATFS time info has it's own format. The solution for NUCLEUS (function TimeTo32(d, t)) looks very similar. Maybe it is the same, but I could not test it yet.

SFTP_GetAttributes_Handle seems to have the same problem.

Activity

  1. embhorn commented on May 12, 2026

    @embhorn
    Member

    Hi @J-Goldacker

    Thanks for contacting wolfSSL Support. Could you tell us a bit about your project using wolfSSH? I've requested a review of this issue by our engineers.

    Kind regards,
    @embhorn - wolfSSL Support

  2. ejohnstown commented on May 12, 2026

    @ejohnstown
    Contributor

    Does the RTOS you are running on have the function mktime()?

  3. ejohnstown commented on May 12, 2026

    @ejohnstown
    Contributor

    I have a fix posted as a PR. I haven't tested the date conversion yet. That's why the PR is a draft. Please let me know if that works for you.

  4. J-Goldacker commented on May 13, 2026

    @J-Goldacker
    ContributorAuthor

    Hi @ejohnstown, thank you very much. I've left two comments in your PR.

    Yes, we have mktime.

    I'll try the changes on the target and give you feedback.

    Edit: I've ran the code. With the change from my comment (add 80 to the year) it works
    #define WS_GETYEAR(d) ((((d) >> 9) & 0x007f) + 80)

  5. ejohnstown commented on May 13, 2026

    @ejohnstown
    Contributor

    I have updated the PR. Thank you for the feedback.

  6. ejohnstown commented on May 13, 2026

    @ejohnstown
    Contributor

    PR #977 is merged. Thanks!

  7. J-Goldacker commented on May 18, 2026

    @J-Goldacker
    ContributorAuthor

    Thank you for solving this so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions