Negative year using stat to get file timestamp

I am reading negative years when trying to read file timestamps using stat.
I have tried with Little-FS and FAT-FS. Platform is STM32F7 and N25Q128A

Output from the following code is :

System-Date : Fri, 28 Sep 2018 08:47:16 GMT
Last Modified : Wed, 19 Apr -201927 01:51:33 GMT
Access-Time : Wed, 19 Apr -201927 01:51:33 GMT
Status-Time : Wed, 19 Apr -201927 01:51:33 GMT

The System Date is incrementing during successive builds. The file timestamps are frozen and it doesn’t matter is I delete the file and rewrite, the timestamps do not change (even reformatting doesn’t help).

Can anyone tell me how to use fstat ?

set_time(1538123990); // Any time doesn’t matter

LittleFileSystem fs; // Also tried with FATFileSystem, no change

FILE *file = fopen(filename, “w+”);
const char *content = “Test meLorem ipsum, etc”;
fprintf(file, content); // Wrote the file

struct stat file_info;
int err = stat(filename, &file_info); // Read file info
if (err !=0)

time_t sys_time = time(NULL);
struct tm *sys_time_struct = gmtime(&sys_time);
char *sys_time_header = new char[80];
strftime(sys_time_header, 80, “Date: %a, %d %b %Y %H:%M:%S %Z\r\n”, sys_time_struct);
printf(“System-Date: %s”, sys_time_header); // Works I can read the system time
delete sys_time_header;

time_t file_time = file_info.st_mtime;
struct tm *file_time_struct = gmtime(&file_time);
char *file_time_header = new char[80];
strftime(file_time_header, 80, “Last-Modified: %a, %d %b %Y %H:%M:%S %Z\r\n”, file_time_struct);
printf(“File: %s”, file_time_header); // Doesn’t work
delete file_time_header;

time_t access_time = file_info.st_atime;
struct tm *access_time_struct = gmtime(&access_time);
char *access_time_header = new char[80];
strftime(access_time_header, 80, “Access-Time: %a, %d %b %Y %H:%M:%S %Z\r\n”, access_time_struct);
printf(“File: %s”, access_time_header); // Doesn’t work
delete access_time_header;

time_t status_time = file_info.st_ctime;
struct tm *status_time_struct = gmtime(&status_time);
char *status_time_header = new char[80];
strftime(status_time_header, 80, “Status change: %a, %d %b %Y %H:%M:%S %Z\r\n”, status_time_struct);
printf(“Status-Time: %s”, status_time_header); // Doesn’t work
delete status_time_header;