[Remind-Fans] patch -- ISO8601 timestamps

hymie at lactose.homelinux.net hymie at lactose.homelinux.net
Mon Jul 25 09:39:18 EDT 2016


Greetings.

I know that work on Remind has stalled if not ended.  But if you should
be making any changes, I would recommend that you adjust the way
Remind expects/prints time/date stamps from the current
yyyy-mm-dd at hh:mm
to the ISO-8601-standard
yyyy-mm-ddThh:mm

I think it's an easy patch.  It might all be in expr.c .  My biggest
concern is what might break if other people/places/scripts depend on
the current @ format.


*** expr.c.orig	2016-07-25 09:32:55.808366669 -0400
--- expr.c	2016-07-25 09:24:42.658366064 -0400
***************
*** 620,626 ****
  	    k = v->v.val % MINUTES_PER_DAY;
  	    h = k / 60;
  	    i = k % 60;
! 	    sprintf(CoerceBuf, "%04d%c%02d%c%02d@%02d%c%02d",
  		    y, DateSep, m+1, DateSep, d, h, TimeSep, i);
  	    break;
  	default: return E_CANT_COERCE;
--- 620,626 ----
  	    k = v->v.val % MINUTES_PER_DAY;
  	    h = k / 60;
  	    i = k % 60;
! 	    sprintf(CoerceBuf, "%04d%c%02d%c%02dT%02d%c%02d",
  		    y, DateSep, m+1, DateSep, d, h, TimeSep, i);
  	    break;
  	default: return E_CANT_COERCE;
***************
*** 1193,1199 ****
      }
      else if (v->type == DATETIME_TYPE) {
  	FromJulian(v->v.val / MINUTES_PER_DAY, &y, &m, &d);
! 	fprintf(fp, "%04d%c%02d%c%02d@%02d%c%02d", y, DateSep, m+1, DateSep, d,
  		(v->v.val % MINUTES_PER_DAY) / 60, TimeSep, (v->v.val % MINUTES_PER_DAY) % 60);
      }
      else fprintf(fp, "ERR");
--- 1193,1199 ----
      }
      else if (v->type == DATETIME_TYPE) {
  	FromJulian(v->v.val / MINUTES_PER_DAY, &y, &m, &d);
! 	fprintf(fp, "%04d%c%02d%c%02dT%02d%c%02d", y, DateSep, m+1, DateSep, d,
  		(v->v.val % MINUTES_PER_DAY) / 60, TimeSep, (v->v.val % MINUTES_PER_DAY) % 60);
      }
      else fprintf(fp, "ERR");
***************
*** 1261,1267 ****
      *jul = Julian(y, m, d);
  
      /* Do we have a time part as well? */
!     if (**s == ' ' || **s == '@') {
  	(*s)++;
  	while(isdigit(**s)) {
  	    hour *= 10;
--- 1261,1267 ----
      *jul = Julian(y, m, d);
  
      /* Do we have a time part as well? */
!     if (**s == ' ' || **s == '@' || **s == 'T' ) {
  	(*s)++;
  	while(isdigit(**s)) {
  	    hour *= 10;

--hymie!    http://lactose.homelinux.net/~hymie    hymie at lactose.homelinux.net



More information about the Remind-fans mailing list