Advertisement
VisualPaul

Untitled

Oct 14th, 2015
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. int main(int argc, char **argv) {
  4.     FILE *input = fopen(argv[1], "r");
  5.     struct tm result;
  6.     struct char buffer[2000];
  7.     time_t prev;
  8.     bool first = true;
  9.     while (fgets(buffer, 2000, input)) {
  10.         struct tm res;
  11.         strptime(buffer, "%Y/%m/%d %H:%M:%S\n", &res);
  12.         time_t cur = mktime(&res);
  13.         if (!first) {
  14.             printf("%d\n", cur - prev);
  15.         }
  16.         prev = cur;
  17.         first = false;
  18.     }
  19.     fclose(input);
  20.    
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement