Nuutti Kotivuori <naked@iki.fi> writes:
> + * This format is used whenever time is shown to the user. It consists
> + * of a machine parseable, almost ISO-8601, part in the beginning -
> + * and a human explanative part at the end. The machine parseable part
I never heard of the word "explanative" before, but hey, English is a
Big Tent language.
> + * is generated strictly by APR and our code, with a apr_snprintf. The
> + * human explanative part is generated by apr_strftime, which means
> + * that it's generation can be affected by locale, it can fail and it
s/it's/its/
> +/* Maximum length for the date string. */
> +#define SVN_SUBR__DATE_MAX_LENGTH 80
SVN_TIME__MAX_LENGTH, maybe? Should use "SVN_TIME__" prefix, anyway.
> + /* Put in machine parseable part */
> + len = apr_snprintf (datestr,
> + SVN_SUBR__DATE_MAX_LENGTH,
> + human_timestamp_format,
> + exploded_time.tm_year + 1900,
> + exploded_time.tm_mon + 1,
> + exploded_time.tm_mday,
> + exploded_time.tm_hour,
> + exploded_time.tm_min,
> + exploded_time.tm_sec,
> + exploded_time.tm_gmtoff / (60 * 60),
> + (exploded_time.tm_gmtoff / 60) % 60);
> +
> + /* If we overfilled the buffer, just return what we got. */
> + if(len >= SVN_SUBR__DATE_MAX_LENGTH)
> + return datestr;
I got confused for a moment, but then learned that apr_snprintf()
returns the buffer's len (i.e., its second arg) in overfill case.
So ">=" is okay, but equivalent to "==", right?
> + /* Calculate offset to the end of the machine parseable part. */
> + curptr = datestr + len;
> +
> + /* Put in human readable part */
> + ret = apr_strftime (curptr,
> + &retlen,
> + SVN_SUBR__DATE_MAX_LENGTH - len,
> + human_timestamp_format_suffix,
> + &exploded_time);
Okay, so in case of overlong length, we sacrifice the user-formatted
part in favor of the machine-parseable part. That seems reasonable.
+1. If this passes "make check", commit it.
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jul 15 22:26:33 2002