[m-rev.] for review: Thread I/O state through time routines that depend on the time zone.

Julien Fischer jfischer at opturion.com
Mon Jun 6 08:57:39 AEST 2016


Hi Peter,

On Sun, 5 Jun 2016, Peter Wang wrote:

> library/time.m:
> 	Deprecate non-pure functions `localtime/1' and `mktime/1'.
> 	They depend on the current time zone, which depends on the
> 	environment that the program is running in, and may also be
> 	changed at run time (e.g. by setting the environment variable
> 	"TZ").
>
> 	Add replacement predicates `localtime/4' and `mktime/4' that
> 	thread the I/O state.
>
> 	Deprecate the non-pure function `ctime/1'.  It does not seem
> 	necessary to add a pure replacement for it, being a minor
> 	convenience at best.
>
> 	Try to clarify some documentation.
> diff --git a/library/time.m b/library/time.m
> index ea9c569..13e3a1e 100644
> --- a/library/time.m
> +++ b/library/time.m
> @@ -150,26 +150,39 @@
>     %
> :- func difftime(time_t, time_t) = float.
> 
> -    % localtime(Time) = TM:
> +    % localtime(Time, TM, !IO):
>     %
> -    % Converts the calendar time `Time' to a broken-down representation,
> -    % expressed relative to the user's specified time zone.
> +    % Converts the (simple) calendar time `Time' to a broken-down
> +    % representation `TM', expressed relative to the user's specified time
> +    % zone.

Saying "specified time zone" suggest to me that the time zone is an
argument of the predicate.  I suggest "current" or "default" as an
alternative.

The rest looks fine.

Julien.


More information about the reviews mailing list