BeOS: Porting UNIX Applications

Time on most computers is handled by some simple variables and structures, and these have been built upon using a number of functions to produce what we call time under UNIX and now POSIX. The BeOS supports the basic POSIX types, with some additional UNIX functions thrown in for good measure.
The epoch is the point at which time began. As far as UNIX and most other operating systems are concerned, this is January 1, 1970, otherwise known as the epoch. The value is the basic unit of time and is stored as a long, which has been typed
#includetypedef long time_t;
Using a 32-bit integer should make the counter last about 68 years, because it is a signed integer value (2 31). This allows the timer to specify a time up to January 18, 2038, based on the epoch more than long enough to last most people!
The difficulty with time_t is that the figure is calculated in seconds, when it is often useful to be able to count in milliseconds. The timeval structure is used to describe the same basic figure as that described using time_t, but the granularity has been reduced to milliseconds:
#includestruct timeval { long tv_sec; long tv_usec; }
| Type | Member | Range | Description |
|---|