Skip to content

ESP8266 LittleFS.mkdir timestamp is always 1-1-1970 (?) #9120

Closed
@arjenv

Description

@arjenv

Running a webserver with javascript on an ESP8266. The ESP is not connected to the WWW, however the client is and returns an epoch upon request from the ESP.

I then set the time with setTime(new_epoch), in which new_epoch is the nr of seconds from 1-1-1970 returned by the client. Client runs from cellphone or PC with a WWW connection.

I check the set time via Serial.print. It is correct.

When I then try and save a new file to LittleFS the timestamp is wrong, it is equal to the 'on' time as returned by milis().

When I add a settimecallback just before the open to write:

File file = LittleFS.open(fullpath, "w");

the timestamp is correct.

Sofar so good.

I then try and create a new directory with LittleFS.mkdir(path). The directory is created but the timestamp is always 1-1-1970 at 0:0:0 time.
Calling the settimecallback() does not solve this.

When settimecallback is called before I open a new file with a directory in front of it, the directory is created and the file is created. The file has the correct timestamp, the directory, however, has again timestamp 1-1-1970

File file = LittleFS.open("newdir/foo.bar, "w");

foor.bar has the correct timestamp.
/newdir/ (directory) has timestamp 1-1-1970.

Is this an issue or did I do something wrong here?

Is bugging me for three days now...

Your input is welcomed. Thanks for your great work.

Metadata

Metadata

Assignees

No one assigned

    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