REVIEW - Standard C Date/Time Library - Programming the World's Calendars and Clocks


Standard C Date/Time Library

Programming the World's Calendars and Clocks


Lance Latham



Focal Press (1998)




Francis Glassborow


October 1998



Before I go any further let me clarify the title. This is a book about a library of date and time functions that are written in Standard C. That is, all the supplied code will compile with a strict ANSI flag set. I have not had time to check this claim but the samples I have tried all compile happily with CodeWarrior.

This is the most comprehensive book for programmers on calendars, clocks and related code that I have ever come across. It includes material about the year 2000 problem (as well as highlighting other date and time limitation problems.) It covers far more than just Julian and Gregorian calendars (even throws in functions to handle a calendar for Mars if you want a bit of fun)

It may appear that this is an expensive book considering the very specific nature of its contents. On the other hand if you consider it as a documented source library its price seems reasonable. However I am a little perturbed by the License information. Statements like:

If you are the individual owner of a copy of this work, you are authorized to use, for your own personal and non-commercial use, one copy of each function...

This smells of legal gobble-de-gook. What does it mean 'to use one copy'? Can I only write one program using a function any specific function? Is shareware a commercial use? At least one company thinks not. Is writing about code (as a journalist etc.) commercial? What about PD software? How do I use the material in this book in articles about programming?

Then we have the Diskette/ROM licence that limits me to a single computer. I may be unusual in having a private network of five machines dedicated to my personal use (well my wife uses one of them). Does this licence mean that I must determine which machine I am going to use the CD on? I know I am splitting hairs but US lawyers make an awful lot of money out of such.

The problem comes down to what this product is. If it is a book about a source code library, it is on the expensive side. If it were a documented library with a licence to use it in products the price would be about right. I think writers must learn to distinguish between distribution of library code (certainly subject to restriction) and distribution of executables where some element was linked from the compiled library.

Unless the author and publisher redefine their claims books such as this one will not act to help by providing standard solutions but become millstones making it harder for the user.

This book is too good and too useful to be allowed to be tied up in a legal quagmire. The author's legitimate desire to protect his intellectual property would be better served by confining himself to such concepts as 'site licences' and 'academic licences' (the concept of a per course academic licence is unlikely to appeal to academics. Even if there is no charge, the admin. hassle is something course organisers can do without).

This book is packed with interesting and useful information but as the CD contains a complete copy of the text as well as all the source code I think we could have done without verbatim hardcopy of the various source code files. A few complete applications would also have been a nice added value.

One serious problem I have with the author's code is that he has hard-coded the names of months, days etc. into English. I thought we had moved on from considering English as the only language.

Two other problems that I have is the prevalence of 'magic numbers' in his code and his use of multiple return statements from nested if statements. The later is tolerable because most of his functions are small but it will infringe some corporate coding standards. The former is plain poor coding technique (a few sensible enums would clean out most ofthe magic numbers).

Cut out unnecessary listings, change the copyright constraints and I would be adding this book to my list of standard references. Without these changes those of you who write code for money will need to investigate what a commercial licence will cost before pursuing purchase.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.