+GDate *post_date;
+gushort lastday;
+
+ DB( g_print("\n[scheduled] date_advance\n") );
+
+ DB( g_print(" arc: '%s'\n", arc->memo ) );
+
+ post_date = g_date_new();
+ g_date_set_julian(post_date, arc->nextdate);
+ // saved the current day number
+ lastday = g_date_get_day(post_date);
+
+ arc->nextdate = _sched_date_get_next_post(post_date, arc, arc->nextdate);
+
+ DB( g_print(" raw next post date: %2d-%2d-%4d\n", g_date_get_day(post_date), g_date_get_month (post_date), g_date_get_year(post_date) ) );
+
+ //for day > 28 we might have a gap to compensate later
+ if( (arc->unit==AUTO_UNIT_MONTH) || (arc->unit==AUTO_UNIT_YEAR) )
+ {
+ if( lastday >= 28 )
+ {
+ DB( g_print(" lastday:%d, daygap:%d\n", lastday, arc->daygap) );
+ if( arc->daygap > 0 )
+ {
+ g_date_add_days (post_date, arc->daygap);
+ arc->nextdate = g_date_get_julian (post_date);
+ lastday += arc->daygap;
+ DB( g_print(" adjusted post date: %2d-%2d-%4d\n", g_date_get_day(post_date), g_date_get_month (post_date), g_date_get_year(post_date) ) );
+ }
+
+ arc->daygap = CLAMP(lastday - g_date_get_day(post_date), 0, 3);
+
+ DB( g_print(" daygap is %d\n", arc->daygap) );
+ }
+ else
+ arc->daygap = 0;
+ }
+
+