Thanks, I figured it out in the end, i used
Code:
timestamp = ctime(&buf.st_mtime);
Only thing was ctime was depeciated but it works for what I needed(was only a tempory solution to the bigger picture)