Category : C++ Source Code
Archive   : WLIB.ZIP
Filename : WTIME.DOC

Output of file : WTIME.DOC contained in archive : WLIB.ZIP
Decisions, decisions, decisions. I know what I need for the
application that I am about to write, yet I don't want to
develop a library unless I can use it again and again. At the
same time, I want a tool that will be easy to understand even
for the very beginner AND something that will work the fastest
and use the least memory. A lot to ask? It seems that when I
develop new stuff, I get what I want by keeping things very
simple. I developed a huge library of date and time stuff in
Turbo Pascal in 1986 (or so). Seven years ago! It's hard to
believe that in four years of programming in C++ I never needed
a date or time class.

At first I thought a class that included both time and date
would be fine. By keeping the resolution down to minutes, I
could store thousands of years in a long integer. However, I
didn't think it would be clear what was happening when taking
that sort of object and adding 5 to it.

I remember the evolution of my Pascal stuff lead to having a
variety of records (structs) I could toss around at any time.
It was faster to take a Gregorian date from the system and
convert it to a string than to get the system date (in
Gregorian format), convert it to Julian and then back to
Gregorian so that it could then be made into a string! OTOH,
adding 7 days to a Gregorian date can be quite a nightmare!
So, I have a small collection of classes: "Date" is what we
human beings are familiar with - storage is in three integers -
month, day and year. "JulianDate" doesn't really use the
Julian calandar, but what we have twisted it to mean in more
recent years - it is the number of days since January 1, 0000.
"Time" is stored as hours, minutes and seconds. "Moment" is
what I needed for the project I'm working on and is the number
of minutes since January 1, 0000 (I need to store thousands of
these in memory and on disk).

Next, there is all the history about Pope Gregory the 13th.
Even though he put together the calandar system we use today
(complete with a leap year schedule) in 1530 (or so), it wasn't
completely accepted for centuries. There is a descrepency about
when was George Washington's birthday since "The Colonies"
accepted the Gregorian calendar during his lifetime and made
for a difference of about 10 days. The bottom line here is
that in doing conversions, I will project back the Gregorian
calendar (erroneously) to Jan 1, 0000. It's truley accurate
from the 1800's on.

  3 Responses to “Category : C++ Source Code
Archive   : WLIB.ZIP
Filename : WTIME.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: