📄 tdat.doc
字号:
TDAT PROGRAMMER'S MANUAL
VERSION 1.0
(Date and Time Functions)
TechniLib Company
Copyright 1995, by TechniLib (TM) Company
All Rights Reserved
TERMS OF USE AND DISTRIBUTION
TDAT is a shareware product; therefore, unregistered copies of TDAT are
made available free of charge so that potential purchasers will have the
opportunity to examine and test the software before committing payment.
Distribution of unregistered copies of TDAT to other potential users is also
permitted and appreciated. However, usage and distribution of TDAT must
conform to the following conditions. In the following statement, the term
"commercial distribution," includes shareware distribution.
1) TDAT and accompanying software must be distributed together in copies of
the original archive provided by TechniLib. Neither the archive nor
individual files therein may be modified.
2) The TDAT archive may be distributed in combination with other shareware
products; however, the TDAT archive may not be distributed with other
commercially distributed software without written consent of TechniLib.
3) Copies of TDAT which have been used to develop software for commercial
distribution must be registered before such software is marketed. Copies of
TDAT which have been used to develop noncommercial software must be registered
if such software is to be regularly used either by the developer or others.
4) Commercially distributed software must embed TDAT procedures in the
software code. Files contained in the TDAT archive may not be placed in the
distribution media.
5) TDAT is designed to offer a set of services to other executable code. TDAT
may not be used to develop software for commercial distribution which will
essentially offer any of these same services to other executable code.
Exceptions to this condition require written consent of TechniLib.
6) Rights afforded by registering a single copy of TDAT pertain only to a
single computer.
7) TDAT may be registered for a fee of $10.00 per copy. Consult README.DOC in
the TDAT archive for further instructions regarding registration.
DISCLAIMER OF WARRANTY
TDAT AND ALL ACCOMPANYING SOFTWARE AND LITERATURE ARE DISTRIBUTED WITH
THE EXCLUSION OF ANY AND ALL IMPLIED WARRANTIES, AND WITH THE EXCLUSION OF
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. TechniLib
SHALL HAVE NO LIABILITY FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
RESULTING FROM THE USE OF TDAT OR ACCOMPANYING MATERIALS. The user assumes
the entire risk of using this software.
Copyright 1995, by TechniLib (TM) Company
All Rights Reserved
INTRODUCTION
------------
TDAT is a library containing useful date and time functions for C and
C++. All TDAT procedures are written in assembly language; consequently, TDAT
is very fast and very compact.
The TDAT archive includes libraries for both Microsoft C and Borland C.
Microsoft libraries are contained in MICROSOF.ZIP. Borland libraries are in
BORLAND.ZIP. Each archive contains files called TDAT.LIB and REGISTRD.ZIP.
The first file is a fully functional version of TDAT but is designed for the
small memory model only. REGISTRD.ZIP contains libraries for all memory
models, but this archive is password protected. Registrants will be sent a
password to open the archive. Registration can be accomplished very quickly
by email. See README.DOC or EMAIL.REG for details.
To use TDAT, the programmer should include the TDAT.H header file in
their C program, and should link the program with the appropriate TDAT
library. The appropriate library will depend upon the memory model being
used. The following is a list of available TDAT libraries matched with their
corresponding memory models.
Library Memory Model
--------- ------------
TDAT.LIB Small
TDATS.LIB Small
TDATC.LIB Compact
TDATM.LIB Medium
TDATL.LIB Large and Huge
TDATL.LIB will work with all memory models provided that the header file is
changed to TDATL.H.
SPECIFICATIONS FOR FUNCTIONS
----------------------------
The following table summarizes the functions contained in TDAT:
Function Action
-------- ------
dateindex() Compute date index
extractdate() Extract century, year, month, and day from date index
weekday() Compute weekday from date index (Sunday = 1, etc.)
currentdate() Compute index for current date
datestr() Compute date string from date index
valdatestr() Compute index from date string
timeindex() Compute time index
extracttime() Extract hour, minute, and second from time index
currenttime() Compute index for current time
timestr() Compute time string from time index
valtimestr() Compute time index from time string
In the following detailed specifications, "ulong" is a synonym for
"unsigned long," and "uint" is a synonym for "unsigned int."
1
Date Functions
--------------
Compute Date Index
------------------
Prototype: ulong dateindex(uint cent, uint yr, uint mo, uint day)
Action: Given a century (cent), year (yr), month (mo), and day (day), return
an index equal to the numbers of days transpiring since 01/01/1900.
Details: dateindex() does not perform validity checks upon its arguments.
Extract Date from Date Index
----------------------------
Prototype: extractdate(ulong index, uint *cent, uint *yr, uint *mo,
uint *day)
Action: Given a date index, compute corresponding century, year, month, and
day, then record such values to pointed locations.
Compute Weekday
---------------
Prototype: uint weekday(ulong index)
Action: Given a date index, return the corresponding weekday, with 1 being
returned for Sunday, 2 being returned for Monday, etc.
Compute Current Date Index
--------------------------
Prototype: ulong currentdate(void)
Action: Return index for current date.
Compute Date String from Date Index
-----------------------------------
Prototype: char *datestr(char *string, ulong index)
Action: Construct a string description of the date in the date index. The
string will have the form: mm/dd/yy. Return *string.
Compute Date Index from Date String
-----------------------------------
Prototype: ulong valdatestr(char *string)
Action: Return date index from date string having the form: mm/dd/yy.
Details: valdatestr() returns -1 if the date string is invalid.
2
Time Functions
--------------
Compute Time Index
------------------
Prototype: ulong timeindex(uint hr, uint min, uint sec)
Action: Given an hour (hr), minute (min), and second (sec), return a time
index equal to the number of seconds transpiring since midnight.
Details: timeindex() does not perform validity checks upon its arguments.
Extract Time from Time Index
----------------------------
Prototype: void extracttime(ulong index, uint *hr, uint *min, uint *sec)
Action: Given a time index, compute the corresponding hour, minute, and
second, then record such values to pointed locations.
Compute Current Time Index
--------------------------
Prototype: ulong currenttime(void)
Action: Return index for current time.
Compute Time String from Time Index
-----------------------------------
Prototype: char *timestr(char *string, ulong index)
Action: Construct a string description of the time in the time index. The
string will have the form: hh:mm:ss. Return *string.
Compute Time Index from Time String
-----------------------------------
Prototype: ulong valtimestr(char *string)
Action: Return time index from time string having the form: hh:mm:ss.
Details: valtimestr() returns -1 if the time string is invalid.
3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -