Orthogonality in UNIX clock primitives

Thomas J Hacker hacker at egrunix.UUCP
Sat Aug 19 04:38:31 AEST 1989




I would like comments and thoughts on this:


On Multics, there exists an orthogonality in the clock functions:
i.e.

clock_ (), which returns the number of microseconds since 1/1/01,

date_time_ (clock_value, ascii_value), which takes a clock value and
  returns an ASCII representation (system standard).


date_time_$format (time_format, clock_value, time_zone, calling_language),
   like strftime in ANSI C.

date_time_$from_clock,  returns ASCII date/time given clock value and time
   zone

date_time_$from_clock_interval, does the diff between two clock values
   and stuffs them into a structure like struct tm in  UNIX.

date_time_$to_clock, like getdate in UNIX.

... and others.

   My point is, the OS should provide the tools for the system
programmers to use, instead of forcing them to write their own
implementation.  Without a stable foundation upon which to build
applications, there is no guarantee of portability across OS releases.
This causes inconsistencies in system code because everyone has to
write their own primitives and when some base objects upon which they depend
change, such as the standard system time string, the program won't work
anymore.

   For example, in the clock primitives in the OS/C libraries in UNIX,
there is NOT the orthogonality that allows simple things like taking
the difference between two clock values and returning the result in
string form.  On our system (4.3BSD), the getdate routine is part of
the news system which will does a very good job of parsing dates, but
the dump command has it's own parsing routine, unctime, that cannot
parse the date format that has the time zone within it.  If there was
a standard subroutine call, there would be no problem, since the
internals would be hidden (vis-a-vis data abstractions).

   To conclude, the clock value should be treated as an object, and
there should be a set of orthogonal primitives provided in the OS that
act upon it for the programmer.

  Well, let me know what you think.
-- 
Thomas Hacker               ...Weave a circle round him thrice,
Systems Programmer             And close your eyes with holy dread, 
Oakland University	       For he on honeydew hath fed, --"Kubla Khan" 
hackertj at unix.secs.oakland.edu And drunk the milk of Paradise. -- ST Coleridge



More information about the Comp.unix.questions mailing list