#include <stdio.h> #include <time.h> int main( void ) { time_t cur = time( NULL ); struct tm* p = localtime( &cur ); printf( "%d\n", 1+p->tm_yday ); }