+ /* Simple -- first week starting with E_SUNDAY / E_MONDAY,
+ days before that are week 0.
+ */
+ int wday = ( timeptr->tm_wday + 7 - wtype ) % 7;
+ div_t week = div( timeptr->tm_yday, 7 );
+ if ( week.rem >= wday )
+ {
+ ++week.quot;
+ }
+ return week.quot;