fork download
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. time_t getElapsedSecond(int yyyy, int mm, int dd, int hh, int nn, int ss){
  5. struct tm workdt;
  6. workdt.tm_isdst = -1; // summer time flag
  7. workdt.tm_year = yyyy - 1900;
  8. workdt.tm_mon = mm - 1;
  9. workdt.tm_mday = dd;
  10. workdt.tm_hour = hh;
  11. workdt.tm_min = nn;
  12. workdt.tm_sec = ss;
  13. return mktime(&workdt);
  14. }
  15.  
  16. int main(void) {
  17. time_t tnow = getElapsedSecond(2017, 8, 2, 18, 29, 00);
  18. printf("%ld\n", tnow);
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
1501698540