#include <ctime>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>

int main(int argc, char** argv) {
  struct dirent *entry = nullptr;
  DIR *directory = nullptr;
  struct stat stat_buf;

  std:time_t timestamp_now = std::time(nullptr);

  directory = opendir(".");
  if (nullptr != directory) {
    while ((entry = readdir(directory))) {
      if ("." == entry->d_name or "." == entry->d_name)
        continue;

      if (stat(entry->d_name, &stat_buf) != 0)
        continue;

      printf ("%i\t", timestamp_now - stat_buf.st_atime);
      printf ("%s\n", entry->d_name);
    }
  }

  closedir(directory);
  return 0;
}

