Created
September 1, 2013 17:38
-
-
Save surgicalmaskman/6406014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<time.h> | |
int main(int argc , char *argv[]) | |
{ | |
time_t now; | |
int year; | |
int month; | |
int day; | |
int foo; | |
struct tm *t_st; | |
time(&now); | |
t_st = localtime(&now); | |
year = t_st->tm_year+1900; | |
month = t_st->tm_mon+1; | |
day = t_st->tm_mday; | |
if(month == 1 || month == 2){ | |
year--; | |
month+=12; | |
} | |
foo = (365.25 * year) + ( year / 400) - (year /100) + (30.59 * (month - 2)) + day - 678912; | |
printf("%d\n",foo); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment