home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
zfamily.zip
/
zfamily
/
ZDTFUNCS
/
HELP
/
ZDTFUNCS.INF
(
.txt
)
next >
Wrap
OS/2 Help File
|
1993-11-17
|
95KB
|
3,628 lines
ΓòÉΓòÉΓòÉ 1. Document Content ΓòÉΓòÉΓòÉ
This document is made up of five parts:
Library Card
General information card for this library.
Installation Guide
How to install the Z Family/2 reusable library and how to use the installed
files.
User's Guide
How to integrate the library with your application and how to call the
corresponding functions and macros.
Reference Manual
Reference information for the functions, macros and structures provided by
this library.
Sample Program
How to call and use the sample program.
ΓòÉΓòÉΓòÉ 2. Library card ΓòÉΓòÉΓòÉ
ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
Package: ZDTFUNCS
Library: FMZDTFUN.DLL
Version: 4.30
Requirements:
OS/2 2.x, C Set/2 or IBM C/C++ Tools 2.0, Toolkit 2.x.
Trademarks
ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
Contact: Dr. Dario de Judicibus
IBMMAIL: ITIBM98W
Internet: ddj@vnet.ibm.com
ΓòÉΓòÉΓòÉ 3. Installation Guide ΓòÉΓòÉΓòÉ
Select one:
Library installation
The expanded tree
ΓòÉΓòÉΓòÉ 3.1. Library installation ΓòÉΓòÉΓòÉ
Select one:
Γûá Package content
Γûá How to install the library
ΓòÉΓòÉΓòÉ 3.1.1. Package content ΓòÉΓòÉΓòÉ
FMZDTFUN.DLL is distributed as a package containing the following files:
ZDTFUNCS.ZIP A ZIP compressed file which contains the library
modules.
ZDTFUNCS.INF The on-line documentation for this reusable library.
ΓòÉΓòÉΓòÉ 3.1.2. How to install the library ΓòÉΓòÉΓòÉ
To install the libraries, you have to perform the following steps:
1. Locate the directory of the CD-ROM, remote partition, or diskette where
ZDTFUNCS.ZIP is placed. Let's say, for example, P:\ZFAMILY.
2. Move to the directory on your system where you want to install the
reusable library. For example, move to D:\REUSE.
3. Unpack the ZIP file by using option -d. Please, note that such option must
be lower case. In our case, issue the following command:
[D:\REUSE] PKUNZIP2 -d P:\ZFAMILY\ZDTFUNCS.ZIP
4. When the command is terminated, a new directory is available on your
system. In our example, P:\ZFAMILY\ZDT. Such a directory contains several
other sub-directories which contains all the files needed to use the
reusable library. The directory tree is described in Library Tree. The
content of each directory is described in detail in Content of
directories.
5. In order to use the library, you must now move the unpacked files to the
appropriate directories in your development environment. In particular
move
o the headers from .\ZDT\H to any directory listed in your INCLUDE
environment variable.
o the import and/or object libraries from .\ZDT\LIB and .\ZDT\DEVEL to any
directory listed in your LIB environment variable.
o the dynamic link libraries from .\ZDT\DLL to any directory listed in your
LIBPATH environment variable.
You may also want to move this file from .\ZDT\HELP to any directory
listed in your BOOKSHELF environment variable.
Now you are ready to work with the ZDT reusable library.
ΓòÉΓòÉΓòÉ 3.2. The expanded tree ΓòÉΓòÉΓòÉ
Select one:
Γûá Library tree
Γûá Content of directories
ΓòÉΓòÉΓòÉ 3.2.1. Library tree ΓòÉΓòÉΓòÉ
When you unpack ZDTFUNCS.ZIP, a new sub-directory is created on your system:
ZDT. Its structure is the following:
current dir
Γöé
Γöé ZDT
Γö£ΓöÇΓöÉ
Γöé Γö£ΓöÇΓöÇΓöÇΓöÇ H
. Γö£ΓöÇΓöÇΓöÇΓöÇ DLL
. Γö£ΓöÇΓöÇΓöÇΓöÇ LIB
. Γö£ΓöÇΓöÇΓöÇΓöÇ MRI
. Γö£ΓöÇΓöÇΓöÇΓöÇ HELP
. Γö£ΓöÇΓöÇΓöÇΓöÇ DEVEL
. ΓööΓöÇΓöÇΓöÇΓöÇ SAMPLE
ΓòÉΓòÉΓòÉ 3.2.2. Content of directories ΓòÉΓòÉΓòÉ
Hereinafter is the list of the directories that are created when ZDTFUNCS.ZIP
is unpacked as described in How to install the library. The content of each
directory is described in detail.
The H sub-directory contains all the header files (H and RCH) to be added to
the INCLUDE path of the application development environment. Move all the files
from this directory to the appropriate path in your environment.
Important If you use other Z Family/2 reusable libraries in your development
environment, ensure that you are using the latest version of the zgeneral.h
header file, which is available in all the library packages. You may do
that by comparing the update dates in the prologue of the header file.
/*
** Module : ZGENERAL.H
** Authors : Dario de Judicibus (DEJUDICI at ROMEPPC)
** Alessandro Cavallini (CAVALLI at ROMEPPC)
** Giacomo Lenoci
** Created : 10 Jan 1992
** Updated : 01 Feb 1993
** Version : 2.30
** Content : General includes for all Z Family/2 DLLs
** Product : Z Family/2 Project (5641-504) FMZ
**
*/
The DLL sub-directory contains all the dynamic link library or libraries (DLL)
to be added to the LIBPATH path of the application development environment and
of the run environment. Move all the files from this directory to the
appropriate path in your environment.
The LIB sub-directory contains all the import library or libraries (LIB) to be
added to the LIB path of the application development environment. Move all the
files from this directory to the appropriate path in your environment.
The MRI sub-directory contains all the translatable objects, that is texts
that might be translated to other languages (see Machine Readable Information
for additional information).
The HELP sub-directory contains the documentation of libraries, and a news
file (ZDTNEWS.DOC) containing modifications applied at the last minute and not
available in the on-line manuals, and the history of changes.
The DEVEL sub-directory contains the object library or libraries (LIB) and the
sample of the DEF and MAK files that can be used to generate your own DLL(s)
(see Create your own library for details).
The SAMPLE sub-directory contains the source code and the executable code of
the sample program. It doesn't contain the DLL file(s) too, anyway. So, to run
the sample, you must ensure that all the required DLL files have been copied
to any directory of your LIBPATH. Such files are not only those pertaining to
this library, but also those belonging on any pre-requisite Z Family/2
Reusable Library.
Important If the library depends on other Z Family/2 reusable libraries, all
the files belonging to the pre-requisite libraries will be part of the
dependent library only in the beta versions of the package.
The final version won't contain any pre-requisite file. That is true for
the SAMPLE sub-directory too. So, you won't be able to recompile the sample
program unless you install the pre-requisite packages too.
ΓòÉΓòÉΓòÉ 4. User's Guide ΓòÉΓòÉΓòÉ
Select one:
General information
Basic topics
Advanced topics
ΓòÉΓòÉΓòÉ 4.1. General information ΓòÉΓòÉΓòÉ
Select one:
Γûá Library overview
Γûá Include files
Γûá Requirements
Γûá Development rules
Γûá Trademarks
ΓòÉΓòÉΓòÉ 4.1.1. Library overview ΓòÉΓòÉΓòÉ
This DLL contains a set of functions to handle dates and times, that is to
o validate dates and times
o extract date and time information
o perform arithmetics with dates and times
o format strings containing dates and times
o compute local times belonging to different time zones
FMZDTFUN.DLL is NLS enabled. In fact, month and weekday names are stored in
other libraries (ZDTRSxxx.DLL) which may be dynamically loaded to support
different languages (xxx is the language identifier).
For details see
ΓûáDefinitions and formats.
ΓûáValid ranges.
ΓûáNLS considerations.
ΓûáSpecification format.
ΓòÉΓòÉΓòÉ 4.1.2. Include files ΓòÉΓòÉΓòÉ
The system include files that are requested to use this library are:
#define INCL_PM
#define INCL_DOS
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <signal.h>
#include <time.h>
The specific include files that are requested to use this library are:
zgeneral.h
Definitions and types for all Z Family/2 DLL's.
zdtdefs.h
Macro and constants for this library.
zdttypes.h
Type definitions for this library.
zdtproto.h
Function prototypes for this library.
Note: The specific includes must be included in the order as listed above.
In addition, the following file is needed because it's included by zdtdefs.h:
zdtrsrcs.rch
String identifiers for the names of months and weekdays.
ΓòÉΓòÉΓòÉ 4.1.3. Requirements ΓòÉΓòÉΓòÉ
FMZDTFUN.DLL is intended to run under OS/2 2.x. It doesn't run under previous
versions of OS/2.
FMZDTFUN.DLL has been compiled by IBM C/C++ Tools 2.0 and statically linked to
the C run-time libraries. Then you don't need such libraries to use it.
Notes FMZDTFUN.DLL functions can be called either from C and from C++. In
addition, an exception handler is registered for each exported function.
A sample program that shows how to use FMZDTFUN.DLL functions is provided in
the DLL's package too. A short description of that sample is available in
Sample program tutorial.
The sample program uses the IMPORTS statement in its .DEF to import the
FMZDTFUN.DLL functions. File FMZDTFUN.LIB is provided too as an alternative to
such solution.
It is also possible to create a clone of FMZDTFUN.DLL by using the files
available in the DEVEL sub-directory of the tree created by exploding the ZIP
file distributed with the package (see Create your own library).
Important
Please, note that even if you use FMZDTFUN.DLL to statically link the DLL
functions, you must install in your system all the resource DLL's,
containing the names of the months and of the days of week in several
languages (ie. FMZDTxxx.DLL). You may avoid that only if you don't use the
following functions:
o zdtDefLangId()
o zdtFormatDate()
o zdtGetLangId()
o zdtLanguage()
o zdtSetLanguage()
o zdtMonthAsString()
o zdtMonthName()
o zdtWeekdayAsString()
o zdtWeekdayAsName()
That means also that you may clone only FMZDTFUN.DLL, but not the resource
libraries.
See NLS considerations for further details on resource DLL.
ΓòÉΓòÉΓòÉ 4.1.4. Development rules ΓòÉΓòÉΓòÉ
To safely integrate any Z Family/2 reusable library in your application, you
need to follow a simple set of rules:
1. Do not use names beginning by a lower case "z" for
o functions
o macros
o global structures
o types
o constants
o #define
o global variables
2. Do not use names beginning by a "z" for
o include files (.H)
o dynamic link libraries (.DLL)
Follow these rules and your code can take full advantage of the services
provided by the current and future Z Family Reusable Libraries/2.
ΓòÉΓòÉΓòÉ 4.1.5. Trademarks ΓòÉΓòÉΓòÉ
IBM Z Family/2 Reusable Libraries is copyrighted by IBM Corporation.
IBM Corporation trademarks
CUA
Common User Access
IBM
IBM C Set/2
IBM C/C++ Tools
Operating System/2
OS/2
Presentation Manager
SAA
Systems Application Architecture
Workplace Shell
Other trademarks
Intel is a trademark of the Intel Corporation.
Microsoft and Windows are trademarks of the Microsoft Corporation.
PKZIP and PKUNZIP are trademarks of the PKWare Corporation.
80386 is a trademark of the Intel Corporation.
ΓòÉΓòÉΓòÉ 4.2. Basic topics ΓòÉΓòÉΓòÉ
Select one:
Γûá Definitions and Formats
Γûá Valid Ranges
Γûá NLS Considerations
Γûá Specification Format
ΓòÉΓòÉΓòÉ 4.2.1. Definitions and formats ΓòÉΓòÉΓòÉ
The following definitions are used in the present document.
Day of month
That number which corresponds to the ordinal position of day in month
starting from the first day in month.
Day
Shortage for day of month
Day of year
That number which corresponds to the ordinal position of day in the year
starting from January 1st..
Weekday
That number which corresponds to the ordinal position of day in a week
starting from Monday (International conventions). See zdtWEEKDAY for
pre-defined values used in FMZDTFUN.DLL.
Julian date
A number representing a date and using format yyddd, where yy are the last
two digits of the year, and ddd is the day of year (eg. 92013).
Date separator
A character used to separate date elements in date formats. Common date
separators are the slash (/) character, the dash (-) character, or the dot
(.) character. It's country dependent.
Anglo-Saxon format
A date format where the first element is the month, the second is the day,
and the third is the year (eg. Jan 3, 1992 or 1/3/92).
European format
A date format where the first element is the day, the second is the month,
and the third is the year (eg. 3 Jan 1992 or 3/1/92).
12h format
A time format where hours range from 0 to 12, provided an additional
information to specify the corresponding half of the day (ie. AM or PM).
24h format
A time format where hours range from 0 to 24.
Sorted format
(1) A date format where the first element is the year, the second is the
month, and the third is the day (eg. 1992.1.3 or 920103). (2) A time format
where the first element is the hours in 24h format, the second element is
minutes, and the third is seconds (eg. 231559).
Timezone
A segment of earth, mostly placed between two meridians, having the same
time. Each time zone is defined by the number of hours, or fraction of
hours, from the Greenwich meridian. Currently such definition has been
slightly changed by the introduction of the Universal Coordinated Time
(UTC).
UTC time
Universal time, that is the base from which all local times are derived by
applying the corresponding time zone value.
Local time
The time in a specific time zone.
Leap second
A second added twice every year to time, to synchronize UTC time and solar
one.
ΓòÉΓòÉΓòÉ 4.2.2. Valid ranges ΓòÉΓòÉΓòÉ
The following section deals with the valid ranges for dates, times, and all the
elements related to them, as weekdays, hours, and so on.
Valid range for dates
The valid range of values for the dates handled by FMZDTFUN.DLL is from January
1st, 1860. to December 31st, 2099 included.
Then the valid range for years is from 1860 to 2099, that one for months is, of
course, 1 to 12, and that one for days depends on the corresponding month and
if the year is leap, that is from 1 to 28, 29, 30 or 31.
The following pre-defined values can be used for the lower and upper limit for
year values:
Name Value Included in range
zdtBASEYEAR 1860 Yes
zdtLASTYEAR 2100 No
FMZDTFUN.DLL functions use an internal format for dates, whose type is FMZDATE.
In fact a date is internally stored as the number of days since January 1st,
1860.
There are two set of pre-defined values that can be used for month and weekday
numbers to write a more readable code:
zdtWEEKDAY for weekday numbers (1..7), that is
MONDAY
TUESDAY
WEDNESDAY
THURSDAY
FRIDAY
SATURDAY
SUNDAY
zdtMONTH for month numbers (1..12), that is
JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER
Note: The first day of week is Monday according to the international
standards. There is no reason to support also the convention that define
Sunday as the first day of week, since in any case you may use the pre-defined
values to check if a certain day is Monday or Sunday. At that point is up to
you to decide how to consider that day in the week.
If an out of range date zdtDATE type) is passed to any of the functions which
extract date information (ie. year, month, weekday and so forth), value
zdtINVALID is returned to the caller.
Valid range for times
The valid range of values for the times handled by FMZDTFUN.DLL is the 24 hour
format range.
Then the valid range for hours is from 0 (midnight) to 24 not included,
whereas that one for minutes and seconds is 0 to 59 included. So, leap
seconds, as defined by UCT standards, are not supported. In fact UCT states
that twice every year is it possible to have a leap second, so that a time
like 11:59:60 may occur.
Time zones are identified by a number of minutes which in most cases depends
on the distance from the Greenwich meridian. Time zones are positive moving
from Greenwich towards east, negative moving towards west.
The following pre-defined values can be used for the lower and upper limit for
zone values:
Name Value Included in range
zdtEASTLIMIT +720 Yes
zdtWESTLIMIT -720 Yes
FMZDTFUN.DLL functions use an internal format for times, whose type is
zdtTIME. In fact a time is internally stored as the number of seconds since
midnight.
ΓòÉΓòÉΓòÉ 4.2.3. NLS considerations ΓòÉΓòÉΓòÉ
All the Z Family/2 Reusable Library libraries are NLS enabled, that is all the
translatable resources are stored in a resource file which may be translated
and included in the library file by using the resource compiler.
In addition however, FMZDTFUN.DLL gives the possibility to dynamically select
the language to be used for the names of months and weekdays. Such strings are
stored in additional libraries, one for each language. Each library is called
FMZDTFUN.DLL where xxx is the language identifier. You may use
zdtSetLanguage() function to select the language to be used by all the
following calls to FMZDTxxx.DLL services, up to the next call to that function.
zdtSetLanguage() accepts as input a pre-defined value of type zdtLANGUAGE.
The currently supported languages are:
Language Identifier zdtLANGUAGE value
Default --- zdtDEFLANG
Brazilian Portuguese "BPO" zdtBPOLANG
Dutch "DUT" zdtDUTLANG
English "ENG" zdtENGLANG
French "FRA" zdtFRALANG
German "DEU" zdtDEULANG
Italian "ITA" zdtITALANG
Spanish "ESP" zdtESPLANG
Swedish "SVE" zdtSVELANG
Danish "DAN" zdtDANLANG
Initial default language is English. You may reset to that default by using the
special value zdtDEFLANG.
You may loop on all supported languages by using the following piece of code:
/*
** Note that zdtLSTLANG is NOT a valid language id
*/
for (i = zdtFSTLANG; i < zdtLSTLANG; i++)
{
printf("Setting language %s\n", zdtLanguageId(i)) ;
printf("Loading library: %s\n", zdtSetLanguage(i)) ;
}
/*
** Let's go back to the default language now.
*/
printf("Default language %s\n", zdtLanguageId(zdtDEFLANG)) ;
printf("Loading library: %s\n", zdtSetLanguage(zdtDEFLANG)) ;
If you want to know how to add another language to those currently supported by
FMZDTFUN.DLL, see How to add another language.
ΓòÉΓòÉΓòÉ 4.2.4. How to add another language ΓòÉΓòÉΓòÉ
If you wish to add another language, just write a resource file based on the
skeleton in ZDTRSxxx.RC skeleton, call it ZDTRSxxx.RC, where xxx is the
language identifier, and send it to
Dr.Dario de Judicibus
Internet : ddj@vnet.ibm.com
IBM mail : ITIBM98W at IBMMAIL
ZDTRSxxx.RC skeleton
/*
** Module : ZDTRSxxx.RC
** Author : <your name> (<your VNET address>)
** Created : <date of creation>
** Version : 1.00
** Content : Resource Compiler Definition for Date & Time services
** Language : <language name>
**
*/
#define INCL_PM
#include "os2.h"
#include "zdtrsrcs.rch"
STRINGTABLE
BEGIN
zdtNAM_MONTH01, "<Month 1>" // ie. January
zdtNAM_MONTH02, "<Month 2>" // ie. February
zdtNAM_MONTH03, "<Month 3>" // ie. March
zdtNAM_MONTH04, "<Month 4>" // ie. April
zdtNAM_MONTH05, "<Month 5>" // ie. May
zdtNAM_MONTH06, "<Month 6>" // ie. June
zdtNAM_MONTH07, "<Month 7>" // ie. July
zdtNAM_MONTH08, "<Month 8>" // ie. August
zdtNAM_MONTH09, "<Month 9>" // ie. September
zdtNAM_MONTH10, "<Month 10>" // ie. October
zdtNAM_MONTH11, "<Month 11>" // ie. November
zdtNAM_MONTH12, "<Month 12>" // ie. December
zdtNAM_WEEKDAY1, "<Weekday 1>" // ie. Monday
zdtNAM_WEEKDAY2, "<Weekday 2>" // ie. Tuesday
zdtNAM_WEEKDAY3, "<Weekday 3>" // ie. Wednesday
zdtNAM_WEEKDAY4, "<Weekday 4>" // ie. Thursday
zdtNAM_WEEKDAY5, "<Weekday 5>" // ie. Friday
zdtNAM_WEEKDAY6, "<Weekday 6>" // ie. Saturday
zdtNAM_WEEKDAY7, "<Weekday 7>" // ie. Sunday
END
ΓòÉΓòÉΓòÉ 4.2.5. Specification format ΓòÉΓòÉΓòÉ
zdtFormatDate() and zdtFormatTime() can be used to format a string which
respectively contains date and time elements. They work as sprintf(), that is
require an input template for the output string, which contains special control
sequences called format specifications.
The zdtFormatDate() and zdtFormatTime() format specifications are just
extensions of those used by C built-in functions. However, while the printf()
escape character is %, the zdtFormatXxxx() control sequence prefix is %%.
You may mix zdtFormatXxxx() and sprintf() format specifications, as long as you
provide also the input values corresponding to the "classic" formats.
Since %% is a valid format for sprintf(), corresponding to a single percent
sign, any triple like %%x being x none of the above characters, will produce
%x. Such pair should be considered as the final output, not furtherly
interpretable by printf().
On the other side, any %... sequence will be translated according to the
classic C rules.
All the arguments corresponding to a C format specification can be provided
after the template, as for sprintf() syntax.
Note: Both functions return the pointer to the target string, provided by the
caller as second argument in the parameter list. If date or time are invalid,
functions return value zdtNOTFORMATTED. In such a case the content of passed
string is unreliable and should not be used.
Formatting dates
The valid zdtFormatDate() format specification are:
%%d day of month
%%m month (number)
%%M month (name)
%%w day of week (number)
%%W day of week (name)
%%y year (short format: last two digits)
%%Y year (long format: all four digits)
%%s date separator
Let's make some example:
date = zdtNewDate(1992,JANUARY,2) ;
/*
** The following call returns a pointer to string "sz"
**
** >>> Thursday 2 January 1992
*/
psz = zdtFormatDate( date, sz, zdtNOSEPARATOR,
"%%W %%d %%M %%Y" ) ;
/*
** The following call returns a pointer to string "sz"
**
** >>> Date is Thursday 2 January 1992
*/
psz = zdtFormatDate( date, sz, zdtNOSEPARATOR,
"%s %%W %%d %%M %%Y","Date is" ) ;
/*
** The following call returns a pointer to string "sz"
**
** >>> 92.01.02 25
*/
psz = zdtFormatDate( date, sz, '.',
"%%y%%s%%m%%s%%d %ul",25 ) ;
/*
** The following call returns a pointer to string "sz"
**
** >>> %92-01-02% %z %
*/
psz = zdtFormatDate( date, sz, '-',
"%%%%y%%s%%m%%s%%d%% %%z %c",'%' ) ;
As you can see in the previous examples, date, the pointer to the target
string (allocated by the caller), and the date separator are provided before
the template, whereas all the parameters related to the C format
specifications follow the template in the function parameter list.
If no separator has to be used, you may use the pre-defined value
zdtNOSEPARATOR.
Formatting times
The valid zdtFormatTime() format specification are:
%%H hours
%%M minutes
%%S seconds
%%s time separator
Let's make some example:
time = zdtNewTime(13,30,15) ;
/*
** The following call returns a pointer to string "sz"
**
** >>> 13h 30m 15s
*/
psz = zdtFormatDate( date, sz, zdtNOSEPARATOR,
"%%Hh %%Mm %%Ss" ) ;
/*
** The following call returns a pointer to string "sz"
**
** >>> Time is 13 30 15
*/
psz = zdtFormatDate( date, sz, zdtNOSEPARATOR,
"%s %%H %%M %%S","Time is" ) ;
/*
** The following call returns a pointer to string "sz"
**
** >>> 13:15.25
*/
psz = zdtFormatDate( date, sz, ':',
"%%H%%s%%M%%s%%S.%ul",25 ) ;
/*
** The following call returns a pointer to string "sz"
**
** >>> %13-30-15% %z %
*/
psz = zdtFormatDate( date, sz, '-',
"%%%%H%%s%%M%%s%%S%% %%z %c",'%' ) ;
As you can see in the previous examples, time, the pointer to the target
string (allocated by the caller), and the time separator are provided before
the template, whereas all the parameters related to the C format
specifications follow the template in the function parameter list.
If no separator has to be used, you may use the pre-defined value
zdtNOSEPARATOR.
ΓòÉΓòÉΓòÉ 4.3. Advanced topics ΓòÉΓòÉΓòÉ
Select one:
Γûá Machine Readable Information
Γûá Signal handling
Γûá Create your own library
Γûá How to generate the clone
Γûá How to use the object library
ΓòÉΓòÉΓòÉ 4.3.1. Machine Readable Information ΓòÉΓòÉΓòÉ
If the library contains translatable pieces of information, they are contained
in resource files available in the MRI sub-directory of the ZDT directory,
created at installation time (see Installation).
To use such files, move all the header files in the H sub-directory to the
appropriate path in your development environment, translate the resource files
to the target language, recompile the file by using the command
rc -r <resource>.RC
to generate the corresponding RES file, and apply the result to the DLL file by
using the command
rc <resource>.RES <name>.DLL
Note that <name> is not FMZDTFUN but the name of the DLL cloned as described in
Create your own library.
ΓòÉΓòÉΓòÉ 4.3.2. Signal handling ΓòÉΓòÉΓòÉ
FMZDTFUN.DLL enables the handling of signals as follows.
First, each exported function is preceeded in code by the corresponding pragma
handler:
Sample
#pragma handler(zdtLibraryVersion)
VOID EXPENTRY zdtLibraryVersion
.
.
.
Second, a standard function, available in any Z Family/2 reusable library, is
provided to register a user's signal handler: zdtRegisterSignal (see
zdtRegisterSignal).
The user's signal handler is a function that accepts as input parameter an
integer, and returns a void. A sample is shown hereinafter:
Sample
void UserSignalHandler (int signal)
{
switch (signal)
{
case SIGILL : /* Prepare to handle SIGILL */ break ;
case SIGSEGV : /* Prepare to handle SIGSEGV */ break ;
case SIGFPE : /* Prepare to handle SIGFPE */ break ;
case SIGTERM : /* Prepare to handle SIGTERM */ break ;
case SIGABRT : /* Prepare to handle SIGABRT */ break ;
case SIGINT : /* Prepare to handle SIGINT */ break ;
case SIGUSR1 : /* Prepare to handle SIGUSR1 */ break ;
case SIGUSR2 : /* Prepare to handle SIGUSR2 */ break ;
case SIGUSR3 : /* Prepare to handle SIGUSR3 */ break ;
case SIGBREAK: /* Prepare to handle SIGBREAK */ break ;
default : /* Unknown signal */ break ;
}
/*
** Handle the received signal according to the previous
** preparation. In general, show a message and terminate
** the program.
*/
}
ΓòÉΓòÉΓòÉ 4.3.3. Create your own library ΓòÉΓòÉΓòÉ
It is possible for the reuser to decide to clone a Z Family/2 reusable library
with a different name. Since the source code is not available to reusers, it
is possible to do that by using the files in the DEVEL sub-directory.
Important Such files are not intended to be used as they are, but should be
modified as described below.
The DEVEL directory contains at least eight files. The first four are:
ZDTFUNCS.LIB An object library
ZDTFUNCS.DEF A skeleton for the definition file
ZDTCLONE.MAK A skeleton for the make file
ZDTSTUB.C A stub file used to generate the library
The others are needed to create a country dependent dynamic link library
containing the names of the months and weekdays. They are:
ZDTRSENG.RES The resource file for the name of months and weekdays in
English
ZDTRSENG.DEF The definition file for creating a country dependent
library.
ZDTRSRCS.MAK The make file to generate a country dependent library.
ZDTRSRCS.C A stub file used to generate the country dependent
library.
In addition, it may also contain one or more resource files, that is
ZDTxxxxx.RES files.
Important
This library may need to load resources from itself, or to get its module
handle. If you clone the library and change its name, it has no way to
automatically know which is its new name. So you need to tell it about. You
can do that by using the zdtSetLibraryName() function.
ΓòÉΓòÉΓòÉ 4.3.4. How to generate the clone ΓòÉΓòÉΓòÉ
To generate a clone of FMZDTFUN.DLL with a different name, you have to execute
the following steps:
1. Edit ZDTCLONE.MAK (see Skeleton of a makefile to clone a Z Family/2 DLL)
changing USRNAME to the wanted name. Let's say, for example, DLLCLONE. You
may want to add other instructions to this make file, but be careful if
you want to change the existing ones In particular, the OPTIONS constant
contains the same options used to compile FMZDTFUN.DLL. If you change
them, the new DLL may not work as expected.
Skeleton of a makefile to clone a Z Family/2 DLL
#
# Module : ZxxCLONE.MAK
# Authors : Luca Miccoli (MICCOLI at ROMEPPC)
# Reviewer : Dario de Judicibus (DEJUDICI at ROMEPPC)
# Created : 06 Apr 1993
# Reviewed : 21 Apr 1993
# Version : 1.00
# Content : Make File for Z Family/2 Clones
#
# ------------------------------------------------------------------------------
#
# NOTE : This is a SAMPLE makefile. You may need to modify it to satisfy your
# specific needs. You may also want to include it in a larger MAKE file
# which is used to generate your application. In any case, read carefully
# the comments below and the "User's Guide", to understand what you can
# change, and what should be used as is.
# ------------------------------------------------------------------------------
#
# User provided name of the .DLL (to be filled)
#
USRNAME = ________
STBNAME = zxxstub
INTNAME = zxxfuncs
RESNAME = zxxrsrcs
#
# Do not change OPTIONS unless really needed. They SHOULD match the original ones.
#
OPTIONS = /Kb /Ge- /Sm /Ss /Gd- /Gm+ /Ms /I-
LINKOPT = /NOI
#
# MAKE file generates a DLL and the corresponding IMPORT library having the
# name specified as USRNAME above.
#
all: $(USRNAME).dll $(USRNAME).lib
#
# STUB should be compiled by using the same options used for Z Family/2 DLL
#
$(STBNAME).obj: $(STBNAME).c
icc /C+ $(OPTIONS) $(STBNAME).c
#
# Use STUB and Z Family/2 OBJECT library to generate the User's Cloned DLL
# Use $(INTNAME).def to make your $(USRNAME).def, changing the name after
# LIBRARY (first instruction of the definition file).
#
$(USRNAME).dll: $(STBNAME).obj $(INTNAME).lib $(USRNAME).def $(RESNAME).res
link386 $(LINKOPT) $(STBNAME).obj,$(USRNAME).dll,,$(INTNAME).lib,$(USRNAME).def ;
rc $(RESNAME).res $(USRNAME).dll
#
# Use the User's Cloned DLL to generate the corresponding IMPORT library
#
$(USRNAME).lib: $(USRNAME).dll $(USRNAME).def
implib $(USRNAME).lib $(USRNAME).def
2. Edit ZDTFUNCS.DEF (see Skeleton of a definition to clone a Z Family/2 DLL)
changing the name after LIBRARY keyword to the wanted name, that is,
DLLCLONE.
Skeleton of a definition to clone a Z Family/2 DLL
;
; Module : ZxxFUNCS.DEF
; Authors : Dario de Judicibus (DEJUDICI at ROMEPPC)
; Mario Turaccio (TURACCIO at ROMEPPC)
; Reviewer : Dario de Judicibus (DEJUDICI at ROMEPPC)
; Created : 21 Oct 1991
; Updated : 01 Apr 1993
; Version : 1.00
; Content : Module Definition File for FMZLXFUN.DLL
; Product : Z Family/2 Project (5641-504) FMZ
;
LIBRARY FMZxxFUN INITINSTANCE TERMINSTANCE
DESCRIPTION '... , Z Family/2 5641-504 (C) Copyright IBM Corporation 1993,1994.'
PROTMODE
CODE LOADONCALL
DATA MULTIPLE READWRITE NONSHARED
HEAPSIZE 32768
STACKSIZE 32768
IMPORTS
FMZyyFUN.zgsLibraryVersion
FMZyyFUN.zgsRegisterSignal
...
EXPORTS
zxxLibraryVersion
zxxRegisterSignal
...
3. Generate the new DLL by executing:
NMAKE - af ZDTCLONE.MAK
ΓòÉΓòÉΓòÉ 4.3.5. How to use the object library ΓòÉΓòÉΓòÉ
An object library called ZDTFUNCS.LIB is available in DEVEL sub-directory.
Such a library is provided to allow the user to clone the FMZDTFUN.DLL library,
as explained in Create your own library.
Important
You may also decide to clone only few function rather than the whole
library. However you cannot use this library to statically link some library
function to your program. In fact, those functions which may need to load
resources from the DLL itself, or to get the library handle to perform
specific activities, wouldn't work any more. This use of the object library
is not supported. You may do that, but at your own risk.
ΓòÉΓòÉΓòÉ 5. Reference Manual ΓòÉΓòÉΓòÉ
Select one:
Function sheets
Macro sheets
Data sheets
ΓòÉΓòÉΓòÉ 5.1. Function sheets ΓòÉΓòÉΓòÉ
Select one:
Γûá zdtLibraryVersion
Γûá zdtSetLibraryName
Γûá zdtRegisterSignal
Γûá zdtAddDays
Γûá zdtAddHours
Γûá zdtAddMinutes
Γûá zdtAddSeconds
Γûá zdtAddToDate
Γûá zdtAsJulian
Γûá zdtComputeLocalTime
Γûá zdtCurLangId
Γûá zdtDateAsString
Γûá zdtDay
Γûá zdtDayOfYear
Γûá zdtDaysBetween
Γûá zdtDaysInMonth
Γûá zdtDayInYear
Γûá zdtDefLangId
Γûá zdtDiscardDate
Γûá zdtDiscardTime
Γûá zdtFormatDate
Γûá zdtFormatTime
Γûá zdtGetLangId
Γûá zdtHours
Γûá zdtIsLeapYear
Γûá zdtIsValidDate
Γûá zdtIsValidTime
Γûá zdtIsValidZone
Γûá zdtLanguage
Γûá zdtLocalZone
Γûá zdtMinutes
Γûá zdtMinutesInTime
Γûá zdtMonth
Γûá zdtMonthAsString
Γûá zdtMonthName
Γûá zdtNewDate
Γûá zdtNewTime
Γûá zdtNow
Γûá zdtSeconds
Γûá zdtSecondsBetween
Γûá zdtSecondsInTime
Γûá zdtSetLanguage
Γûá zdtStringAsDate
Γûá zdtStringAsTime
Γûá zdtStringIsDate
Γûá zdtStringIsTime
Γûá zdtTimeAsString
Γûá zdtToday
Γûá zdtUtcNow
Γûá zdtUtcToday
Γûá zdtWeekday
Γûá zdtWeekdayAsString
Γûá zdtWeekdayName
Γûá zdtWeekOfYear
Γûá zdtYear
ΓòÉΓòÉΓòÉ 5.1.1. zdtLibraryVersion ΓòÉΓòÉΓòÉ
Provide information about library version and the date and time of compilation
of the DLL source code.
Prototype
VOID EXPENTRY zdtLibraryVersion
(
zPLIBVERS pLibVers
) ;
Parameters
pLibVers
Pointer to a zLIBVERS structure. That structure should be allocated by
the caller. Its content, if any, will be overwritten.
result
The zLIBVERS structure whose pointer is provided as input parameter is
filled.
Notes
Look at zLIBVERS for the definition of zLIBVERS structure.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.2. zdtSetLibraryName ΓòÉΓòÉΓòÉ
Set the value of the private variable zdtDllName. See also Create your own
library.
Important If called, this function must be called before any other library
function.
Prototype
VOID EXPENTRY zdtSetLibraryName
(
PSZ szNewName
) ;
Parameters
szNewName
Pointer to the string containing the new name of library. If you pass a
NULL pointer or an empty string, the library name is set to its default,
that is zdtDLLNAME.
result
None.
Notes
If you clone FMZDTFUN.DLL, you obtain a new library with a new name. Since
this library may need to know its name to load resources or get its module
handle, you have to tell it which is the new name. You can use this function
to do that. The default name is zdtDLLNAME.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.3. zdtRegisterSignal ΓòÉΓòÉΓòÉ
It allows to register an application signal handler for exception handling.
Prototype
zSIGNAL EXPENTRY zdtRegisterSignal
(
zSIGHAND SigHandler
)
Parameters
SigHandler
Pointer to the application signal handler to be registered. Type is
zSIGHAND (see Z Family/2 general constants).
result
zREGISTERED if the handler has been successfully registered, otherwise it
returns the signal for which the registration failed. See Signal
handling types for the complete list of signals and their meaning.
Notes
Look at Signal handling for a description of the exception handling feature
provided by FMZDTFUN.DLL.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.4. zdtAddDays ΓòÉΓòÉΓòÉ
Return the date of the day which occurs a certain number of days after/before a
specified date.
Prototype
zdtDATE EXPENTRY zdtAddDays
(
zdtDATE date ,
zdtDAYS days
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
days
An integer which represents the offset of the requested date with respect
the provided one. It might be negative too.
result
The date which occurs a certain number of days after/before the specified
date. See also Valid ranges.
Notes
No check is made if the resulting date is still valid. It might be out of the
valid range too.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.5. zdtAddHours ΓòÉΓòÉΓòÉ
Return the time which occurs a certain number of hours after/before a specified
time. If the new time belongs to a different day than the specified one, a day
shift value is returned.
Prototype
zdtTIME EXPENTRY zdtAddHours
(
zdtTIME time ,
zdtHOURS hours ,
zdtDAYS *shift
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
hours
An integer which represents the difference in hours between the requested
time and the provided one. It might be negative too.
shift
The pointer to an integer value which will contain the day shift, if any.
Returned integer might be negative too.
result
The time which occurs a certain number of hours after/before the
specified time. If date changes too, the day shift is returned in shift.
See also Valid ranges.
Notes
If the day changes too, the caller may obtain the new date by using the
zdtAddDays() function, if interested.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.6. zdtAddMinutes ΓòÉΓòÉΓòÉ
Return the time which occurs a certain number of minutes after/before a
specified time. If the new time belongs to a different day than the specified
one, a day shift value is returned.
Prototype
zdtTIME EXPENTRY zdtAddMinutes
(
zdtTIME time ,
zdtMINUTES minutes ,
zdtDAYS *shift
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
minutes
An integer which represents the difference in minutes between the
requested time and the provided one. It might be negative too.
shift
The pointer to an integer value which will contain the day shift, if any.
Returned integer might be negative too.
result
The time which occurs a certain number of minutes after/before the
specified time. If date changes too, the day shift is returned in shift.
See also Valid ranges.
Notes
If the day changes too, the caller may obtain the new date by using the
zdtAddDays() function, if interested.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.7. zdtAddSeconds ΓòÉΓòÉΓòÉ
Return the time which occurs a certain number of seconds after/before a
specified time. If the new time belongs to a different day than the specified
one, a day shift value is returned.
Prototype
zdtTIME EXPENTRY zdtAddSeconds
(
zdtTIME time ,
zdtSECONDS seconds ,
zdtDAYS *shift
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
seconds
An integer which represents the difference in seconds between the
requested time and the provided one. It might be negative too.
shift
The pointer to an integer value which will contain the day shift, if any.
Returned integer might be negative too.
result
The time which occurs a certain number of seconds after/before the
specified time. If date changes too, the day shift is returned in shift.
See also Valid ranges.
Notes
If the day changes too, the caller may obtain the new date by using the
zdtAddDays() function, if interested.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.8. zdtAddToDate ΓòÉΓòÉΓòÉ
Return the date that is obtained by adding a certain number of days and/or
months and/or years to the specified date. See the notes below for the logic
used by this function.
Prototype
zdtDATE EXPENTRY zdtAddToDate
(
zdtDATE date ,
ULONG years ,
ULONG months ,
ULONG days
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
years
The number of years to be added to the specified date.
months
The number of months to be added to the specified date.
days
The number of days to be added to the specified date.
result
The date which occurs a certain number of days, months, and years after
specified date. If the incoming date is not valid, returns zdtINVALID.
See also Valid ranges.
Notes
Note that, differently from zdtAddDays(), this function does not add a fixed
number of days to the specified date, but a total amount of days which depends
on the initial date and on the order in which addends are applied.
For example, adding one month to January 2nd, 1993, to obtain February 2nd,
1993 is equivalent to add 31 days. On the other side, adding one month to
February 2nd, 1993 to obtain March 2nd, 1993 is equivalent to add 28 days.
Furthermore, we must be careful when we consider in which order the addends
should be applied to the initial date. In fact, let's suppose that we want to
add fifteen days, one month and one year to February 18th, 1991.
If we add first the days, we obtain March 5th, 1991. Now, adding one month and
one year, we respectively obtain April 5th, 1991 and April 5th, 1992. However,
if we add first one year, we obtain February 18th, 1992. Now, since 1992 is a
leap year, adding fifteen days to such a date, we obtain March 4th, 1991. The
final result, obtained by adding one month, is therefore April 4th, 1992.
Important
zdtAddToDate() adds first the days, then the months, and last the years.
Take in account such logic when you use it.
No check is made if the resulting date is still valid. It might be out of the
valid range too.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.9. zdtAsJulian ΓòÉΓòÉΓòÉ
Return the Julian day of the specified date. See Definitions and formats for
details about date formats.
Prototype
zdtDAYS EXPENTRY zdtAsJulian
(
zdtDATE date
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
result
The Julian day for the specified date (provided in the internal format),
or zdtINVALID if the date is incorrect.
Notes
Note that the Julian day returned by this function includes the last two
digits of the year too. Thence it is not unique among different centuries. For
example 72015 corresponds to either January 15th, 1972 or January 15th, 1672.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.10. zdtComputeLocalTime ΓòÉΓòÉΓòÉ
Return the date and time corresponding to a specific time zone, given the
corresponding time zone value, and the date, time and zone values of another
time zone.
Prototype
BOOL EXPENTRY zdtComputeLocalTime
(
zdtLOCALDT *dta ,
zdtLOCALDT *dtb
)
Parameters
dta
The pointer to a structure which contains the date, time and zone values
of a specific time zone.
dtb
The pointer to a structure which contains the zone value of another time
zone, whose date and time are unknown.
result
The date and time fields of the structure pointed by dtb are filled and
TRUE is returned if the operation has been performed successfully.
Otherwise the function returns FALSE and the target structure is not
filled.
Notes
See zdtLOCALDT for details about the zdtLOCALDT structure.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.11. zdtCurLangId ΓòÉΓòÉΓòÉ
Return the language identifier corresponding to language currently set (see NLS
considerations).
Prototype
PSZ EXPENTRY zdtCurLangId
(
VOID
)
Parameters
(void)
No arguments are needed.
result
The current language identifier.
Notes
At the beginning the current language corresponds to the default language.
Setting can be changed by zdtSetLanguage().
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.12. zdtDateAsString ΓòÉΓòÉΓòÉ
Return a pointer to a string with the date in the sorted format, that is
yyyymmdd. See Definitions and formats for details about date formats.
Prototype
PSZ EXPENTRY zdtDateAsString
(
zdtDATE date ,
PSZ sorted
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
sorted
The pointer to the string to be filled by the function. It should be 9
bytes long, at least.
result
The pointer to a string containing the sorted format of the date, or
zdtNOTFORMATTED if date is not valid.
Notes
This function is NLS enabled since it doesn't contain any date separator.
Note that this function cannot perform any check on the size of the target
string. It is caller's responsibility to guarantee a string length large
enough to contain the formatted date.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.13. zdtDay ΓòÉΓòÉΓòÉ
Return the day of the month for the specified date.
Prototype
zdtDAY EXPENTRY zdtDay
(
zdtDATE date
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
result
The day of month for the specified date (provided in the internal
format), or zdtINVALID if the date is incorrect. The day of month is a
number between 1 and 28, 29, 30 or 31, depending on the month and if the
year is leap. See also Valid ranges.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.14. zdtDayOfYear ΓòÉΓòÉΓòÉ
Return the day of year of the provided date.
Prototype
zdtDAYS EXPENTRY zdtDayOfYear
(
zdtDATE date
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
result
The day of year of the provided date, or zdtINVALID if the date is
invalid.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.15. zdtDaysBetween ΓòÉΓòÉΓòÉ
Return the number of days between two dates.
Prototype
zdtDAYS EXPENTRY zdtDaysBetween
(
zdtDATE date1 ,
zdtDATE date2
)
Parameters
date1
A earlier date, provided in the internal representation (as generated by
zdtNewDate()).
date2
A older date, provided in the internal representation (as generated by
zdtNewDate()).
result
The number of days between the two dates.
Notes
No check is done if date1 > date2. Then the result might be a negative number
too.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.16. zdtDaysInMonth ΓòÉΓòÉΓòÉ
Return the number of days in a particular month in a particular year.
Prototype
zdtDAYS EXPENTRY zdtDaysInMonth
(
zdtYEAR year ,
zdtMONTH month
)
Parameters
year
Date year. It must be a number between zdtBASEYEAR (included) and
zdtLASTYEAR (excluded). See also Valid ranges.
month
Date month. It must be a number between JANUARY and DECEMBER included.
See also Valid ranges.
result
The number of days in the month, adjusted for leap years.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.17. zdtDaysInYear ΓòÉΓòÉΓòÉ
Return the number of days in a particular year.
Prototype
zdtDAYS EXPENTRY zdtDaysInYear
(
zdtYEAR year
)
Parameters
year
Date year. It must be a number between zdtBASEYEAR (included) and
zdtLASTYEAR (excluded). See also Valid ranges.
result
The number of days in the year, adjusted for leap years.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.18. zdtDefLangId ΓòÉΓòÉΓòÉ
Return the default language identifier, whatever be the current setting (see
NLS considerations).
Prototype
PSZ EXPENTRY zdtDefLangId
(
VOID
)
Parameters
(void)
No arguments are needed.
result
The default language identifier.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.19. zdtDiscardDate ΓòÉΓòÉΓòÉ
Date destructor (as opposed to zdtNewDate()). Currently does nothing. Reserved
for future usage.
Prototype
VOID EXPENTRY zdtDiscardDate
(
zdtDATE date
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
result
None.
Notes
This function is useless, at the moment. It is reserved for future usage as
date destructor. You may ignore it.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.20. zdtDiscardTime ΓòÉΓòÉΓòÉ
Time destructor (as opposed to zdtNewTime()). Currently does nothing. Reserved
for future usage.
Prototype
VOID EXPENTRY zdtDiscardTime
(
zdtTIME time
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
result
None.
Notes
This function is useless, at the moment. It is reserved for future usage as
time destructor. You may ignore it.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.21. zdtFormatDate ΓòÉΓòÉΓòÉ
Return a pointer to a string with the date formatted as described by the format
field.
Prototype
PSZ EXPENTRY zdtFormatDate
(
zdtDATE date ,
PSZ stamp ,
CHAR sep ,
PSZ format ,
...
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
stamp
The pointer to the string to be filled by the function.
sep
The character to be used to separate the three components of the date
string, if any, or zdtNOSEPARATOR if none.
format
A string template that describes how the date should be formatted. See
Specification format for a description of template layouts.
┬╖┬╖┬╖
Other parameters that match the sprintf-like escape sequences.
result
The pointer to a string containing the formatted date, or zdtNOTFORMATTED
if the date is incorrect. Note that in the latter case the returned value
is different from that of stamp.
Notes
The template used for this function is an extension of that used by sprintf(),
sscanf() and other similar C functions. In fact you may use the same syntax
and the same format specifications used by such functions, providing the same
argument list you would provide in those cases. Refer to Specification format
for a description of template layouts.
Note that this function cannot perform any check on the size of the target
string. It is caller's responsibility to guarantee a string length large
enough to contain the formatted date.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.22. zdtFormatTime ΓòÉΓòÉΓòÉ
Return a pointer to a string with the time formatted as described by the format
field.
Prototype
PSZ EXPENTRY zdtFormatTime
(
zdtTIME time ,
PSZ stamp ,
CHAR sep ,
PSZ format ,
...
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
stamp
The pointer to the string to be filled by the function.
sep
The character to be used to separate the three components of the time
string, if any, or zdtNOSEPARATOR if none.
format
A string template that describes how the time should be formatted. See
Specification format for a description of template layouts.
┬╖┬╖┬╖
Other parameters that match the sprintf-like escape sequences.
result
The pointer to a string containing the formatted time, or zdtNOTFORMATTED
if the time is incorrect. Note that in the latter case the returned value
is different from that of stamp.
Notes
The template used for this function is an extension of that used by sprintf(),
sscanf() and other similar C functions. In fact you may use the same syntax
and the same format specifications used by such functions, providing the same
argument list you would provide in those cases. Refer to Specification format
for a description of template layouts.
Note that this function cannot perform any check on the size of the target
string. It is caller's responsibility to guarantee a string length large
enough to contain the formatted time.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.23. zdtGetLangId ΓòÉΓòÉΓòÉ
Return the language identifier corresponding to the provided language (see NLS
considerations).
Prototype
PSZ EXPENTRY zdtGetLangId
(
zdtLANGUAGE lang
)
Parameters
lang
Language whose identifier is requested. See NLS considerations for a list
of language identifiers, or zdtLANGUAGE.
result
The corresponding language identifier, or zdtNOID if the language is not
supported.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.24. zdtHours ΓòÉΓòÉΓòÉ
Return the first piece of the specified time, corresponding to the hours.
Prototype
zdtHOURS EXPENTRY zdtHours
(
zdtTIME time
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
result
The hours of the specified time (provided in the internal format), or
zdtINVALID if the time is incorrect. This is a number between 0 included
and 24 excluded (24h format). See also Valid ranges.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.25. zdtIsLeapYear ΓòÉΓòÉΓòÉ
Check if year is leap.
Prototype
BOOL EXPENTRY zdtIsLeapYear
(
zdtYEAR year
)
Parameters
year
Any date year.
result
TRUE if the input year is leap, FALSE otherwise
Notes
This function work for any year. It has not to be a number between
zdtBASEYEARt (included) and zdtLASTYEAR (excluded). Anyway be aware that such
a restriction applies to most of the FMZDTFUN.DLL functions that accept years
as input. See also Valid ranges.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.26. zdtIsValidDate ΓòÉΓòÉΓòÉ
Check if a date, provided as year, month, day, is valid.
Prototype
BOOL EXPENTRY zdtIsValidDate
(
zdtYEAR year ,
zdtMONTH month ,
zdtDAY day
)
Parameters
year
Date year. It must be a number between zdtBASEYEAR (included) and
zdtLASTYEAR (excluded). See also Valid ranges.
month
Date month. It must be a number between JANUARY and DECEMBER included.
See also Valid ranges.
day
Date day of month. It must be a number between 1 and 28, 29, 30 or 31,
depending on month and year (if leap). See also Valid ranges.
result
TRUE if the input values correspond to a valid date, FALSE otherwise.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.27. zdtIsValidTime ΓòÉΓòÉΓòÉ
Check if a time, provided as hours, minutes and seconds, is valid.
Prototype
BOOL EXPENTRY zdtIsValidTime
(
zdtHOURS hours ,
zdtMINUTES minutes ,
zdtSECONDS seconds
)
Parameters
hours
Time hours. It must be a number between 0 (included) and 24 (excluded).
See also Valid ranges.
minutes
Time minutes. It must be a number between 0 and 59 included. See also
Valid ranges.
seconds
Time seconds. It must be a number between 0 and 59 included. Leap seconds
are not supported at the moment. See also Valid ranges.
result
TRUE if the input values correspond to a valid time, FALSE otherwise.
Notes
None.
Known bugs
UCT leap seconds are not supported.
ΓòÉΓòÉΓòÉ 5.1.28. zdtIsValidZone ΓòÉΓòÉΓòÉ
Check if a time zone, in minutes, is valid.
Prototype
BOOL EXPENTRY zdtIsValidZone
(
zdtZONE zone
)
Parameters
zone
Time zone. It must be a number between zdtWESTLIMIT and zdtEASTLIMIT
included. See also Valid ranges.
result
TRUE if the input value correspond to a valid zone, FALSE otherwise.
Notes
Time zones must be provided in minutes, because there are countries that have
the official hour that differs from the Greenwich hour for hour fractions.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.29. zdtLanguage ΓòÉΓòÉΓòÉ
Return the language corresponding to the provided language identifier (see NLS
considerations).
Prototype
zdtLANGUAGE EXPENTRY zdtLanguage
(
PSZ langid
)
Parameters
langid
Language identifier whose corresponding language is requested. See NLS
considerations for a list of language identifiers, or zdtLANGUAGE.
result
The language corresponding to that identifier, or zdtINVALID if that
language identifier is invalid, not supported, or unknown.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.30. zdtLocalZone ΓòÉΓòÉΓòÉ
Return the time zone of the workstation where the function is executed.
Prototype
zdtZONE EXPENTRY zdtLocalZone
(
VOID
)
Parameters
(void)
No arguments are needed.
result
The local time zone corresponding to current system date and time, in
minutes. If the local time zone cannot be computed, this function returns
zdtINVALID.
Notes
Time zone is returned in minutes, because there are countries that have the
official hour that differs from the Greenwich hour for hour fractions.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.31. zdtMinutes ΓòÉΓòÉΓòÉ
Return the second piece of the specified time, corresponding to the minutes.
Prototype
zdtMINUTES EXPENTRY zdtMinutes
(
zdtTIME time
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
result
The minutes of the specified time (provided in the internal format), or
zdtINVALID if the time is incorrect. This is a number between 0 included
and 60 excluded. See also Valid ranges.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.32. .zdtMinutesInTime ΓòÉΓòÉΓòÉ
Return the total number of minutes in time.
Prototype
zdtMINUTES EXPENTRY zdtMinutesInTime
(
zdtTIME time
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
result
The number of minutes in time.
Notes
Differently from zdtMinutes(), this function does not return the number of
minutes representing the second piece of a time value, but the total number of
minutes since midnight for that time. For example:
min = zdtMinutes(zdtNewTime(3,20,15)) ; // min = 20
tot = zdtMinutesInTime(zdtNewTime(3,20,15)) ; // tot = 200
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.33. zdtMonth ΓòÉΓòÉΓòÉ
Return the month of the date.
Prototype
zdtMONTH EXPENTRY zdtMonth
(
zdtDATE date
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
result
The month of the specified date (provided in the internal format), or
zdtINVALID if the date is incorrect. The month is a number between
JANUARY and DECEMBER included. See also Valid ranges.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.34. .zdtMonthAsString ΓòÉΓòÉΓòÉ
Return a pointer to a string with the date's month's name in it.
Prototype
PSZ EXPENTRY zdtMonthAsString
(
zdtMONTH month ,
PSZ name
)
Parameters
month
Date month. It must be a number between JANUARY and DECEMBER included.
See also Valid ranges.
name
The pointer to the string to be filled by the function.
result
The pointer to the string containing the month's name, or zdtNOTAVAILABLE
if the date is incorrect.
Notes
This function is NLS enabled. See NLS considerations for details.
Note that this function cannot perform any check on the size of the target
string. It is caller's responsibility to guarantee a string length large
enough to contain the month name. Don't forget that such length depends on the
selected current language too.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.35. .zdtMonthName ΓòÉΓòÉΓòÉ
Return a pointer to a string with the date's month's name in it.
Prototype
PSZ EXPENTRY zdtMonthName
(
zdtDATE date ,
PSZ name
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
name
The pointer to the string to be filled by the function.
result
The pointer to the string containing the month's name, or zdtNOTAVAILABLE
if the date is incorrect.
Notes
This function is NLS enabled. See NLS considerations for details.
Note that this function cannot perform any check on the size of the target
string. It is caller's responsibility to guarantee a string length large
enough to contain the month name. Don't forget that such length depends on the
selected current language too.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.36. zdtNewDate ΓòÉΓòÉΓòÉ
Generates an internal representation of the specified date, provided as year,
month, day.
Prototype
zdtDATE EXPENTRY zdtNewDate
(
zdtYEAR year ,
zdtMONTH month ,
zdtDAY day
)
Parameters
year
Date year. It must be a number between zdtBASEYEAR (included) and
zdtLASTYEAR (excluded). See also Valid ranges.
month
Date month. It must be a number between JANUARY and DECEMBER included.
See also Valid ranges.
day
Date day of month. It must be a number between 1 and 28, 29, 30 or 31,
depending on month and year (if leap). See also Valid ranges.
result
The internal representation of the specified date, or zdtINVALID if date
is invalid.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.37. zdtNewTime ΓòÉΓòÉΓòÉ
Generates an internal representation of the specified time, provided as hours,
minutes, seconds (24h format).
Prototype
zdtTIME EXPENTRY zdtNewTime
(
zdtHOURS hours ,
zdtMINUTES minutes ,
zdtSECONDS seconds
)
Parameters
hours
Time hours. It must be a number between 0 (included) and 24 (excluded).
See also Valid ranges.
minutes
Time minutes. It must be a number between 0 and 59 included. See also
Valid ranges.
seconds
Time seconds. It must be a number between 0 and 59 included. Leap seconds
are not supported at the moment. See also Valid ranges.
result
The internal representation of the specified time, or zdtINVALID if time
is invalid.
Notes
None.
Known bugs
UCT leap seconds are not supported.
ΓòÉΓòÉΓòÉ 5.1.38. zdtNow ΓòÉΓòÉΓòÉ
Return the internal representation of today's local time.
Prototype
zdtTIME EXPENTRY zdtNow
(
VOID
)
Parameters
(void)
No arguments are needed.
result
The local time corresponding to current system time, provided in the
internal representation (as generated by zdtNewTime()). If local time
cannot be retrieved, this function returns zdtINVALID.
Notes
This function assumes that the time retrieved from the system clock is in the
supported range. No validation is performed.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.39. zdtSeconds ΓòÉΓòÉΓòÉ
Return the third piece of the specified time, corresponding to the seconds.
Prototype
zdtSECONDS EXPENTRY zdtSeconds
(
zdtTIME time
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
result
The seconds of the specified time (provided in the internal format), or
zdtINVALID if the time is incorrect. This is a number between 0 included
and 60 excluded. See also Valid ranges.
Notes
None.
Known bugs
UCT leap seconds are not supported.
ΓòÉΓòÉΓòÉ 5.1.40. zdtSecondsBetween ΓòÉΓòÉΓòÉ
Return the number of seconds between two dates.
Prototype
zdtSECONDS EXPENTRY zdtSecondsBetween
(
zdtTIME time1 ,
zdtTIME time2
)
Parameters
time1
A earlier time, provided in the internal representation (as generated by
zdtNewTime()).
time2
A older time, provided in the internal representation (as generated by
zdtNewTime()).
result
The number of seconds between the two times.
Notes
No check is done if time1 > time2. Then the result might be a negative number
too.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.41. zdtSecondsInTime ΓòÉΓòÉΓòÉ
Return the total number of seconds in time.
Prototype
zdtSECONDS EXPENTRY zdtSecondsInTime
(
zdtTIME time
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
result
The number of seconds in time.
Notes
Differently from zdtSeconds(), this function does not return the number of
seconds representing the third piece of a time value, but the total number of
seconds since midnight for that time. For example:
sec = zdtSeconds(zdtNewTime(3,20,15)) ; // sec = 15
tot = zdtSecondsInTime(zdtNewTime(3,20,15)) ; // tot = 12015
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.42. zdtSetLanguage ΓòÉΓòÉΓòÉ
Set the language to be used for weekdays' and months' names (see NLS
considerations).
Prototype
PSZ EXPENTRY zdtSetLanguage
(
zdtLANGUAGE lang
)
Parameters
lang
Language to be used. See NLS considerations for a list of language
identifiers, or zdtLANGUAGE.
result
The filename of the DLL which contains the requested resources in the
specified language.
Notes
See How to add another language to know how to add a new language to those
current supported by FMZDTFUN.DLL.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.43. zdtStringAsDate ΓòÉΓòÉΓòÉ
Convert a date contained in a string in the sorted format to the internal
representation. See Definitions and formats for details about date formats.
Prototype
zdtDATE EXPENTRY zdtStringAsDate
(
PSZ string
)
Parameters
string
Pointer to a string containing the date in the sorted format (ie.
yyyymmd).
result
A date, provided in the internal representation (as generated by
zdtNewDate()), or zdtINVALID if the string does not contain a valid date.
Notes
Valid ranges describes which is the valid range for dates for FMZDTFUNC.DLL
functions.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.44. zdtStringAsTime ΓòÉΓòÉΓòÉ
Convert a time contained in a string in the sorted format to the internal
representation. See Definitions and formats for details about time formats.
Prototype
zdtTIME EXPENTRY zdtStringAsTime
(
PSZ string
)
Parameters
string
Pointer to a string containing the date in the sorted format (ie.
hhmmss).
result
A time, provided in the internal representation (as generated by
zdtNewTime()), or zdtINVALID if the string does not contain a valid time.
Notes
Valid ranges describes which is the valid range for times for FMZDTFUN.DLL
functions.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.45. zdtStringIsDate ΓòÉΓòÉΓòÉ
Check if a date contained in a string in the sorted format belongs to the valid
range for FMZDTFUN.DLL functions. See Definitions and formats for details about
date formats.
Prototype
BOOL EXPENTRY zdtStringIsDate
(
PSZ string
)
Parameters
string
Pointer to a string containing the date in the sorted format (ie.
yyyymmdd).
result
TRUE if the input string represents a valid date for FMZDTFUN.DLL
functions, FALSE otherwise.
Notes
Valid ranges describes which is the valid range for dates for FMZDTFUN.DLL
functions.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.46. zdtStringIsTime ΓòÉΓòÉΓòÉ
Check if a time contained in a string in the sorted format belongs to the valid
range for FMZDTFUN.DLL functions. See Definitions and formats for details about
time formats.
Prototype
BOOL EXPENTRY zdtStringIsTime
(
PSZ string
)
Parameters
string
Pointer to a string containing the time in the sorted format (ie.
hhmmss).
result
TRUE if the input string represents a valid time for FMZDTFUN.DLL
functions, FALSE otherwise.
Notes
Valid ranges describes which is the valid range for times for FMZDTFUN.DLL
functions.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.47. zdtTimeAsString ΓòÉΓòÉΓòÉ
Return a pointer to a string with the time in the sorted format, that is
hhmmss. See Definitions and formats for details about time formats.
Prototype
PSZ EXPENTRY zdtTimeAsString
(
zdtTIME time ,
PSZ sorted
)
Parameters
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
sorted
The pointer to the string to be filled by the function. It should be 7
bytes long, at least.
result
The pointer to a string containing the sorted format of the time, or
zdtNOTFORMATTED if time is not valid.
Notes
This function is NLS enabled since it doesn't contain any time separator.
Note that this function cannot perform any check on the size of the target
string. It is caller's responsibility to guarantee a string length large
enough to contain the formatted time.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.48. zdtToday ΓòÉΓòÉΓòÉ
Return the internal representation of today's local date.
Prototype
zdtDATE EXPENTRY zdtToday
(
VOID
)
Parameters
(void)
No arguments are needed.
result
The local date corresponding to current system date, provided in the
internal representation (as generated by zdtNewDate()). If local date
cannot be retrieved, this function returns zdtINVALID.
Notes
This function assumes that the date retrieved from the system clock is in the
supported range. No validation is performed.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.49. zdtUtcNow ΓòÉΓòÉΓòÉ
Return the internal representation of today's UTC time.
Prototype
zdtTIME EXPENTRY zdtUtcNow
(
VOID
)
Parameters
(void)
No arguments are needed.
result
The UTC time corresponding to current system time, provided in the
internal representation (as generated by zdtNewTime()). If UTC time
cannot be retrieved, this function returns zdtINVALID.
Notes
UTC stands for Coordinated Universal Time.
This function assumes that the time retrieved from the system clock is in the
supported range. No validation is performed.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.50. zdtUtcToday ΓòÉΓòÉΓòÉ
Return the internal representation of today's UTC date.
Prototype
zdtDATE EXPENTRY zdtUtcToday
(
VOID
)
Parameters
(void)
No arguments are needed.
result
The UTC date corresponding to current system date, provided in the
internal representation (as generated by zdtNewDate()). If UTC date
cannot be retrieved, this function returns zdtINVALID.
Notes
UTC stands for Coordinated Universal Time.
This function assumes that the date retrieved from the system clock is in the
supported range. No validation is performed.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.51. zdtWeekday ΓòÉΓòÉΓòÉ
Return the weekday number (international standard).
Prototype
zdtWEEKDAY EXPENTRY zdtWeekday
(
zdtDATE date
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
result
The weekday number for the specified date (provided in the internal
format), or zdtINVALID if the date is incorrect. The weekday number is a
value between 1 (Monday) and 7 (Sunday). See also Valid ranges.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.52. zdtWeekdayAsString ΓòÉΓòÉΓòÉ
Return a pointer to a string with the date's weekday's name in it.
Prototype
PSZ EXPENTRY zdtWeekdayAsString
(
zdtWEEKDAY weekday ,
PSZ name
)
Parameters
weekday
The weekday number must be a value between 1 (Monday) and 7 (Sunday). See
also Valid ranges.
name
The pointer to the string to be filled by the function.
result
The pointer to the string containing the weekday's name, or
zdtNOTAVAILABLE if the date is incorrect.
Notes
This function is NLS enabled. See NLS considerations for details.
Note that this function cannot perform any check on the size of the target
string. It is caller's responsibility to guarantee a string length large
enough to contain the weekday name. Don't forget that such length depends on
the selected current language too.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.53. zdtWeekdayName ΓòÉΓòÉΓòÉ
Return a pointer to a string with the date's weekday's name in it.
Prototype
PSZ EXPENTRY zdtWeekdayName
(
zdtDATE date ,
PSZ name
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
name
The pointer to the string to be filled by the function.
result
The pointer to the string containing the weekday's name, or
zdtNOTAVAILABLE if the date is incorrect.
Notes
This function is NLS enabled. See NLS considerations for details.
Note that this function cannot perform any check on the size of the target
string. It is caller's responsibility to guarantee a string length large
enough to contain the weekday name. Don't forget that such length depends on
the selected current language too.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.54. zdtWeekOfYear ΓòÉΓòÉΓòÉ
Return the week of the year.
Prototype
zdtWEEK EXPENTRY zdtWeekOfYear
(
zdtDATE date
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
result
The week of the year format), or zdtINVALID if the date is incorrect.
The week of the year is a value between 1 and 53. See also Valid ranges.
Notes
The week of the year depends on the convention used for the first day of the
week. FMZDTFUN.DLL uses the international convention, as described in Valid
ranges. If you use the USA convention, just check if day is Sunday (by using
zdtWeekday), and in such a case decrease the week of the year by one.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.55. zdtYear ΓòÉΓòÉΓòÉ
Return the absolute year of date.
Prototype
zdtYEAR EXPENTRY zdtYear
(
zdtDATE date
)
Parameters
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
result
The absolute year of the specified date (provided in the internal
format), or zdtINVALID if the date is incorrect. The absolute year is a
number between zdtBASEYEAR (included) and zdtLASTYEAR (excluded). See
also Valid ranges.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.2. Macro sheets ΓòÉΓòÉΓòÉ
This library has no macros.
ΓòÉΓòÉΓòÉ 5.3. Data sheets ΓòÉΓòÉΓòÉ
Select one:
Γûá zLIBVERS
Γûá Signal handling types
Γûá zdtLANGUAGE
Γûá zdtLOCALDT
Γûá zdtMONTH
Γûá zdtWEEKDAY
Γûá FMZDTFUN.DLL types
Γûá FMZDTFUN.DLL constants
Γûá Z Family/2 general constants
ΓòÉΓòÉΓòÉ 5.3.1. zLIBVERS ΓòÉΓòÉΓòÉ
This structure is used by all Z Family/2 DLL's to maintain information about
the level of the library, and the date and time of compilation of library
source code.
Structure
typedef struct zLibVersion
{
USHORT Version ;
USHORT Release ;
USHORT Modification ;
CHAR String[zLEVELSIZE] ;
CHAR Stamp[zSTAMPSIZE] ;
CHAR Name[zNAMESIZE] ;
}
zLIBVERS, *zPLIBVERS ;
Fields
Version
Library version. Updated only when major functional changes are applied
to the library code.
Release
Library release. Updated only when minor functional changes are applied
to the library code.
Modification
Library modification. Updated when fixes are applied to the library
code.
String
A string containing the library level (version plus release). It must
match the values of version and release.
Stamp
A string containing the compilation time stamp. Usually the C Set/2
predefined constant __TIMESTAMP__ is assigned to this field.
Name
A string containing the library name. If the library was cloned with a
different name, and zdtSetLibraryName() was previously called, this
string contains the name of the clone.
Include file
zgeneral.h
Notes
This structure is the same for all the Z Family/2 DLL's.
ΓòÉΓòÉΓòÉ 5.3.2. Signal handling types ΓòÉΓòÉΓòÉ
Two types are used in the signal handling feature of FMZHPFUN.DLL: zSIGHAND
and zSIGNAL.
zSIGHAND is the pointer to a signal handler function that can be used as
argument when zdtRegisterSignal() is called (see Signal handling for details
about how to write a signal handler).
zSIGNAL is the signal event that may be returned by zdtRegisterSignal() if the
registration of the signal handler fails.
Definition
typedef int zSIGNAL ;
typedef void (*zSIGHAND)(int) ;
Signals
This is the list of the possible values whose type is zSIGNAL.
SIGILL
Illegal instruction (invalid function image)
SIGSEGV
Invalid access to memory
SIGFPE
Floating point exception
SIGTERM
OS/2 SIGTERM (killprocess) signal
SIGABRT
Abort() signal
SIGINT
OS/2 SIGINTR signal
SIGUSR1
User exception in range 0xA0000000-0xBFFFFFFF
SIGUSR2
User exception in range 0xC0000000-0xDFFFFFFF
SIGUSR3
User exception in range 0xE0000000-0xFFFFFFFF
SIGBREAK
OS/2 Ctrl-Break sequence
Include file
zgeneral.h
Notes
These types are the same for all the Z Family/2 DLL's.
ΓòÉΓòÉΓòÉ 5.3.3. zdtLANGUAGE ΓòÉΓòÉΓòÉ
It's the type for the supported languages.
Definition
#define zdtDEFLANG 0 // Default value. Always first in set.
#define zdtITALANG 1 // Italian
#define zdtENGLANG 2 // English
#define zdtBPOLANG 3 // Brazilian Portuguese
#define zdtDEULANG 4 // German
#define zdtSVELANG 5 // Svedish
#define zdtESPLANG 6 // Spanish
#define zdtFRALANG 7 // French
#define zdtDUTLANG 8 // Dutch
#define zdtDANLANG 9 // Danish
#define zdtLSTLANG 10 // Special value. Always last in set.
typedef LONG zdtLANGUAGE ;
Include files
zdtdefs.h
zdttypes.h
Notes
See NLS considerations for detail about the use of the described type.
Important Do not rely on the real values of the above constants, since they
may change in future. Use always the constant names.
ΓòÉΓòÉΓòÉ 5.3.4. zdtLOCALDT ΓòÉΓòÉΓòÉ
This structure is used by zdtComputeLocalTime() for the date, time and zone
values corresponding to a specific time zone.
Structure
typedef struct
{
zdtDATE date ;
zdtTIME time ;
zdtZONE zone ;
}
zdtLOCALDT ;
Fields
date
A date, provided in the internal representation (as generated by
zdtNewDate()).
time
A time, provided in the internal representation (as generated by
zdtNewTime()).
zone
Time zone. It must be a number between zdtWESTLIMIT and zdtESTLIMIT
included. See also Valid ranges.
Include file
zdttypes.h
Notes
None.
ΓòÉΓòÉΓòÉ 5.3.5. zdtMONTH ΓòÉΓòÉΓòÉ
It's the type for the month numbers.
Definition
#define JANUARY 1
#define FEBRUARY 2
#define MARCH 3
#define APRIL 4
#define MAY 5
#define JUNE 6
#define JULY 7
#define AUGUST 8
#define SEPTEMBER 9
#define OCTOBER 10
#define NOVEMBER 11
#define DECEMBER 12
typedef LONG zdtMONTH ;
Include file
zdtdefs.h
zdttypes.h
Notes
See Valid ranges for detail about the use of the described type.
ΓòÉΓòÉΓòÉ 5.3.6. zdtWEEKDAY ΓòÉΓòÉΓòÉ
It's the type for the weekday numbers.
Definition
#define MONDAY 1
#define TUESDAY 2
#define WEDNESDAY 3
#define THURSDAY 4
#define FRIDAY 5
#define SATURDAY 6
#define SUNDAY 7
typedef LONG zdtWEEKDAY ;
Include file
zdtdefs.h
zdttypes.h
Notes
See Valid ranges for detail about the use of the described type.
ΓòÉΓòÉΓòÉ 5.3.7. Other FMZDTFUN.DLL types ΓòÉΓòÉΓòÉ
Hereinafter a list of other types that could be used by the applications that
are dynamically linked to FMZDTFUN.DLL is shown.
zdtDATE
A date in the FMZDTFUN.DLL representation.
zdtDAY
Day of month.
zdtDAYS
Any amount of days.
zdtHOURS
Hours.
zdtMINUTES
Minutes.
zdtSECONDS
Seconds.
zdtTIME
Time.
zdtWEEK
Week of year.
zdtYEAR
Year.
zdtZONE
Zone offset (in minutes).
Include file
zdttypes.h
Notes
None.
ΓòÉΓòÉΓòÉ 5.3.8. Library constants ΓòÉΓòÉΓòÉ
Hereinafter a list of all the constants that could be used by the applications
that are dynamically linked to FMZLMFUN.DLL is shown.
zdtDLLNAME
The default name of this library. Note that, if you clone this library,
the real name must be changed by using the zdtSetLibraryName() function.
In such a case, you cannot use any more this constant.
zdtZPREFIX
The Z Family/2 identifier of this library.
zdtBASEYEAR
Lower value for year (included in range).
zdtLASTYEAR
Higher value for year (excluded from range).
zdtINVALID
It's returned by all the functions that extract information from a date.
It means that the date is not in the valid supported range.
zdtNOTAVAILABLE
It's returned by all the functions that fill a string if that string
cannot be loaded because the input data are not correct.
zdtNOTFORMATTED
It's returned by all the functions that format a string if that string
cannot be generated because the input data are not correct.
zdtHOURSINDAY
Number of hours in one day.
zdtSECONDSINDAY
Number of seconds in one day.
zdtSECONDSINHOUR
Number of seconds in one hour.
zdtSECONDSINMINUTE
Number of seconds in one minute.
zdtMINUTESINHOUR
Number of minutes in one hour.
zdtEASTLIMIT
East limit for timezones (in minutes).
zdtWESTLIMIT
West limit for timezones (in minutes).
zdtNOSEPARATOR
Used in zdtFormatDate() and zdtFormatTime() when no separator should be
use when formatting the input data.
Include file
zdtdefs.h
Notes
None.
ΓòÉΓòÉΓòÉ 5.3.9. Z Family/2 general constants ΓòÉΓòÉΓòÉ
The following constants are shared by all Z Family/2 DLL's.
zPRODPREF
Z Family/2 three-character product prefix (ZDT).
zPRODNUMB
Z Family/2 product number (5641-504).
zCOPYRIGHT
Z Family/2 copyright statement.
zNAMESIZE
Maximum size of Name string in zLIBVERS.
zLEVELSIZE
Maximum size of Level string in zLIBVERS.
zSTAMPSIZE
Maximum size of Stamp string in zLIBVERS.
zNULLERRORID
Null error identifier. To be used when the error identifier can be
ignored by the called function.
zEXEMINERRID
Minimum value of error identifiers for user applications.
zEXEMAXERRID
Maximum value of error identifiers for user applications.
zDLLMINERRID
Minimum value of error identifiers for the Z Family/2 DLL's.
zDLLMAXERRID
Maximum value of error identifiers for the Z Family/2 DLL's.
zSIGNAL
Z Family/2 signal type for signal handling.
zSIGHAND
Z Family/2 signal handler type for signal handling.
zBIT
Z Family/2 type used for unsigned bits.
Include file
zgeneral.h
Notes
Error identifiers are used to identify both the error itself, and the message
associated with it.
ΓòÉΓòÉΓòÉ 6. Sample Program ΓòÉΓòÉΓòÉ
Select one:
Running the sample program
Sample program tutorial
ΓòÉΓòÉΓòÉ 6.1. Running the sample program ΓòÉΓòÉΓòÉ
Important
To run the sample program, you must already have installed the library as
described in How to install the library.
Do not double-click on the item below unless
1. you copied the sample program to a directory listed in your PATH, or added
the directory where the sample program is to your PATH.
2. you copied all the needed dynamic libraries to a directory listed in your
LIBPATH, or added the directory where such libraries are to your LIBPATH.
Hit me to run the sample
ΓòÉΓòÉΓòÉ 6.2. Sample program tutorial ΓòÉΓòÉΓòÉ
The FMZDTFUN.DLL package contains also a sample program that shows how to use
the DLL functions.
The program is called DTEINF and can be launched either from an OS/2 window (or
full-screen), or from the OS/2 Desktop, double-clicking on its icon.
When the program is executed, a small windows appear on the screen.
DTEINF window has only a single pull-down menu, called Date. If you open that
menu you can see four items:
Check..
A dialog box is displayed. Its title is Check date. On the top left
corner there is a combo box that allows you to select the language to
be used for the names of weekdays and months. A list is available in
NLS considerations.
The box left side contains three input fields, that allow you to enter
the day, month and year of a date. As you press the large vertical
button in the middle of the box (that one marked by arrow), the
program fills the output fields on the right side of the box. There are
five of them, which show
o the name of the weekday
o the name of the month
o the day of the year
o the corresponding Julian date
o the week of the year
Below such fields there is a check box that shows if year is leap.
You may check as many dates as you like. If a date is out of the
supported range (see Valid ranges) an error message is displayed. When
you have finished, just press OK to close the dialog box.
Timezones...
A dialog box is displayed. Its title is Timezones. It can be used to
compute the local time of a specified time zone given the UTC Time, or
if you like, time at Greenwich meridian (which is practically the
same).
Dialog consists of three segments.
The top segment contains three fields, to enter the UTC Time as hours,
minutes and seconds.
The central segment can be used to specify the time zone offset with
respect Greenwich. You may type in the offset field, placed on top of a
bitmap showing a world map, or use the slider below the bitmap. The two
controls are linked, so that a change of one updates the other. Offset
is given in hour, rather than minutes, as requested by
zdtComputeLocalTime().
The third section is used to compute the requested local time and show
it. It consists of a button marked by a arrow, and three output
fields. When you press the button, the resulting time is displayed in
the three fields as hours, minutes, and seconds (24h format).
You may check as many times as you like. If a time or the time zone
value are out of the supported range (see Valid ranges) an error
message is displayed. When you have finished, just press OK to close
the dialog box.
About
A message box containing the name of the library, its version, the
author and some other related information (eg. copyright) is displayed.
The first two fields are obtained by the zdtLibraryVersion() function.
Exit
The user is prompted for the confirmation of the EXIT request.
Program ends.