fork download
  1. #include <time.h>
  2. #include <stdio.h>
  3. int main(void){
  4. struct tm start;
  5. struct tm end;
  6. struct tm current;
  7.  
  8. /*
  9. the following member is ignored when the variable passed to
  10. mktime.
  11. the value is modified to the correct value
  12. after the function call.
  13.  
  14. start.tm_wday;
  15. start.tm_yday;
  16.  
  17. */
  18. start.tm_isdst = 0;
  19. start.tm_year = 2010 - 1900;
  20. start.tm_mon = 0;
  21. start.tm_mday = 1;
  22. start.tm_hour = 0;
  23. start.tm_min = 0;
  24. start.tm_sec = 0;
  25.  
  26. end.tm_isdst = 0;
  27. end.tm_year = 2011 - 1900;
  28. end.tm_mon = 0;
  29. end.tm_mday = 1;
  30. end.tm_hour = 0;
  31. end.tm_min = 0;
  32. end.tm_sec = 0;
  33.  
  34. current = start;
  35.  
  36. while(difftime(mktime(&end),mktime(&current)) > 0){
  37.  
  38. printf("%04d-%02d-%02d(%d)\n",1900 + current.tm_year,current.tm_mon + 1,current.tm_mday,current.tm_wday);
  39.  
  40. time_t temp;
  41. temp = mktime(&current) + 86400;
  42. current = *(gmtime(&temp));
  43.  
  44. }
  45.  
  46. }
Success #stdin #stdout 0s 1852KB
stdin
Standard input is empty
stdout
2010-01-01(5)
2010-01-02(6)
2010-01-03(0)
2010-01-04(1)
2010-01-05(2)
2010-01-06(3)
2010-01-07(4)
2010-01-08(5)
2010-01-09(6)
2010-01-10(0)
2010-01-11(1)
2010-01-12(2)
2010-01-13(3)
2010-01-14(4)
2010-01-15(5)
2010-01-16(6)
2010-01-17(0)
2010-01-18(1)
2010-01-19(2)
2010-01-20(3)
2010-01-21(4)
2010-01-22(5)
2010-01-23(6)
2010-01-24(0)
2010-01-25(1)
2010-01-26(2)
2010-01-27(3)
2010-01-28(4)
2010-01-29(5)
2010-01-30(6)
2010-01-31(0)
2010-02-01(1)
2010-02-02(2)
2010-02-03(3)
2010-02-04(4)
2010-02-05(5)
2010-02-06(6)
2010-02-07(0)
2010-02-08(1)
2010-02-09(2)
2010-02-10(3)
2010-02-11(4)
2010-02-12(5)
2010-02-13(6)
2010-02-14(0)
2010-02-15(1)
2010-02-16(2)
2010-02-17(3)
2010-02-18(4)
2010-02-19(5)
2010-02-20(6)
2010-02-21(0)
2010-02-22(1)
2010-02-23(2)
2010-02-24(3)
2010-02-25(4)
2010-02-26(5)
2010-02-27(6)
2010-02-28(0)
2010-03-01(1)
2010-03-02(2)
2010-03-03(3)
2010-03-04(4)
2010-03-05(5)
2010-03-06(6)
2010-03-07(0)
2010-03-08(1)
2010-03-09(2)
2010-03-10(3)
2010-03-11(4)
2010-03-12(5)
2010-03-13(6)
2010-03-14(0)
2010-03-15(1)
2010-03-16(2)
2010-03-17(3)
2010-03-18(4)
2010-03-19(5)
2010-03-20(6)
2010-03-21(0)
2010-03-22(1)
2010-03-23(2)
2010-03-24(3)
2010-03-25(4)
2010-03-26(5)
2010-03-27(6)
2010-03-28(0)
2010-03-29(1)
2010-03-30(2)
2010-03-31(3)
2010-04-01(4)
2010-04-02(5)
2010-04-03(6)
2010-04-04(0)
2010-04-05(1)
2010-04-06(2)
2010-04-07(3)
2010-04-08(4)
2010-04-09(5)
2010-04-10(6)
2010-04-11(0)
2010-04-12(1)
2010-04-13(2)
2010-04-14(3)
2010-04-15(4)
2010-04-16(5)
2010-04-17(6)
2010-04-18(0)
2010-04-19(1)
2010-04-20(2)
2010-04-21(3)
2010-04-22(4)
2010-04-23(5)
2010-04-24(6)
2010-04-25(0)
2010-04-26(1)
2010-04-27(2)
2010-04-28(3)
2010-04-29(4)
2010-04-30(5)
2010-05-01(6)
2010-05-02(0)
2010-05-03(1)
2010-05-04(2)
2010-05-05(3)
2010-05-06(4)
2010-05-07(5)
2010-05-08(6)
2010-05-09(0)
2010-05-10(1)
2010-05-11(2)
2010-05-12(3)
2010-05-13(4)
2010-05-14(5)
2010-05-15(6)
2010-05-16(0)
2010-05-17(1)
2010-05-18(2)
2010-05-19(3)
2010-05-20(4)
2010-05-21(5)
2010-05-22(6)
2010-05-23(0)
2010-05-24(1)
2010-05-25(2)
2010-05-26(3)
2010-05-27(4)
2010-05-28(5)
2010-05-29(6)
2010-05-30(0)
2010-05-31(1)
2010-06-01(2)
2010-06-02(3)
2010-06-03(4)
2010-06-04(5)
2010-06-05(6)
2010-06-06(0)
2010-06-07(1)
2010-06-08(2)
2010-06-09(3)
2010-06-10(4)
2010-06-11(5)
2010-06-12(6)
2010-06-13(0)
2010-06-14(1)
2010-06-15(2)
2010-06-16(3)
2010-06-17(4)
2010-06-18(5)
2010-06-19(6)
2010-06-20(0)
2010-06-21(1)
2010-06-22(2)
2010-06-23(3)
2010-06-24(4)
2010-06-25(5)
2010-06-26(6)
2010-06-27(0)
2010-06-28(1)
2010-06-29(2)
2010-06-30(3)
2010-07-01(4)
2010-07-02(5)
2010-07-03(6)
2010-07-04(0)
2010-07-05(1)
2010-07-06(2)
2010-07-07(3)
2010-07-08(4)
2010-07-09(5)
2010-07-10(6)
2010-07-11(0)
2010-07-12(1)
2010-07-13(2)
2010-07-14(3)
2010-07-15(4)
2010-07-16(5)
2010-07-17(6)
2010-07-18(0)
2010-07-19(1)
2010-07-20(2)
2010-07-21(3)
2010-07-22(4)
2010-07-23(5)
2010-07-24(6)
2010-07-25(0)
2010-07-26(1)
2010-07-27(2)
2010-07-28(3)
2010-07-29(4)
2010-07-30(5)
2010-07-31(6)
2010-08-01(0)
2010-08-02(1)
2010-08-03(2)
2010-08-04(3)
2010-08-05(4)
2010-08-06(5)
2010-08-07(6)
2010-08-08(0)
2010-08-09(1)
2010-08-10(2)
2010-08-11(3)
2010-08-12(4)
2010-08-13(5)
2010-08-14(6)
2010-08-15(0)
2010-08-16(1)
2010-08-17(2)
2010-08-18(3)
2010-08-19(4)
2010-08-20(5)
2010-08-21(6)
2010-08-22(0)
2010-08-23(1)
2010-08-24(2)
2010-08-25(3)
2010-08-26(4)
2010-08-27(5)
2010-08-28(6)
2010-08-29(0)
2010-08-30(1)
2010-08-31(2)
2010-09-01(3)
2010-09-02(4)
2010-09-03(5)
2010-09-04(6)
2010-09-05(0)
2010-09-06(1)
2010-09-07(2)
2010-09-08(3)
2010-09-09(4)
2010-09-10(5)
2010-09-11(6)
2010-09-12(0)
2010-09-13(1)
2010-09-14(2)
2010-09-15(3)
2010-09-16(4)
2010-09-17(5)
2010-09-18(6)
2010-09-19(0)
2010-09-20(1)
2010-09-21(2)
2010-09-22(3)
2010-09-23(4)
2010-09-24(5)
2010-09-25(6)
2010-09-26(0)
2010-09-27(1)
2010-09-28(2)
2010-09-29(3)
2010-09-30(4)
2010-10-01(5)
2010-10-02(6)
2010-10-03(0)
2010-10-04(1)
2010-10-05(2)
2010-10-06(3)
2010-10-07(4)
2010-10-08(5)
2010-10-09(6)
2010-10-10(0)
2010-10-11(1)
2010-10-12(2)
2010-10-13(3)
2010-10-14(4)
2010-10-15(5)
2010-10-16(6)
2010-10-17(0)
2010-10-18(1)
2010-10-19(2)
2010-10-20(3)
2010-10-21(4)
2010-10-22(5)
2010-10-23(6)
2010-10-24(0)
2010-10-25(1)
2010-10-26(2)
2010-10-27(3)
2010-10-28(4)
2010-10-29(5)
2010-10-30(6)
2010-10-31(0)
2010-11-01(1)
2010-11-02(2)
2010-11-03(3)
2010-11-04(4)
2010-11-05(5)
2010-11-06(6)
2010-11-07(0)
2010-11-08(1)
2010-11-09(2)
2010-11-10(3)
2010-11-11(4)
2010-11-12(5)
2010-11-13(6)
2010-11-14(0)
2010-11-15(1)
2010-11-16(2)
2010-11-17(3)
2010-11-18(4)
2010-11-19(5)
2010-11-20(6)
2010-11-21(0)
2010-11-22(1)
2010-11-23(2)
2010-11-24(3)
2010-11-25(4)
2010-11-26(5)
2010-11-27(6)
2010-11-28(0)
2010-11-29(1)
2010-11-30(2)
2010-12-01(3)
2010-12-02(4)
2010-12-03(5)
2010-12-04(6)
2010-12-05(0)
2010-12-06(1)
2010-12-07(2)
2010-12-08(3)
2010-12-09(4)
2010-12-10(5)
2010-12-11(6)
2010-12-12(0)
2010-12-13(1)
2010-12-14(2)
2010-12-15(3)
2010-12-16(4)
2010-12-17(5)
2010-12-18(6)
2010-12-19(0)
2010-12-20(1)
2010-12-21(2)
2010-12-22(3)
2010-12-23(4)
2010-12-24(5)
2010-12-25(6)
2010-12-26(0)
2010-12-27(1)
2010-12-28(2)
2010-12-29(3)
2010-12-30(4)
2010-12-31(5)