be9e5faa96a0773d42929c54f58ded53f40b7e88 braney Mon Dec 12 15:59:17 2016 -0800 some changes that make it easier for trash cleaner to squirrel away custom tracks holding BLAT results diff --git src/lib/common.c src/lib/common.c index 3c48e49..42bf462 100644 --- src/lib/common.c +++ src/lib/common.c @@ -3543,30 +3543,39 @@ case 5: case 8: case 10: days = 30; break; case 1: days = 28; if ( (tp->tm_year % 4) == 0 && ((tp->tm_year % 20) != 0 || (tp->tm_year % 100) == 0) ) days = 29; break; default: days = 31; break; } return days; } +unsigned dayOfYear() +/* Return the day of the year. */ +{ +time_t now = time(NULL); +struct tm *tm = localtime(&now); + +return tm->tm_yday; +} + static void dateAdd(struct tm *tp,int addYears,int addMonths,int addDays) /* Add years,months,days to a date */ { tp->tm_mday += addDays; tp->tm_mon += addMonths; tp->tm_year += addYears; int dom=28; while ( (tp->tm_mon >11 || tp->tm_mon <0) || (tp->tm_mday>dom || tp->tm_mday<1) ) { if (tp->tm_mon>11) // First month: tm.tm_mon is 0-11 range { tp->tm_year += (tp->tm_mon / 12); tp->tm_mon = (tp->tm_mon % 12); }