Avaya Logo

Previous Topic

Next Topic

Book Contents

Book Index

dtstoi

The dtstoi instruction converts the date and time from the tm structure to a system internal form.

Synopsis

dtstoi(type.src, type.dst)

Description

The dtstoi instruction converts the tm structure specified by the type.src argument and converts it to the internal system representation. The result is placed in type.dst. An integer type should be used for type.dst. This instruction is the complement to the dtitos instruction.

The dtstoi instruction returns 0 in script register 0 (r.0) if the conversion is successful. A value of -1 is returned in r.0 if the tm structure indicated by type.src contains incorrect values or is at a location outside the script data area.

Example

In the following example, the script fragment gets the current system date and time, truncates the hour to midnight, and converts the result back to system time stored at location MIDNGT.

#define TM 8
#define TM_SEC 8 /* seconds after the minute (0-59) */
#define TM_MIN 12 /* minutes after the hour (0-59) */
#define TM_HOUR 16 /* hour since midnight (0-23) */
#define TM_MDAY 20 /* day of the month (1-31) */
#define TM_MON 24 /* months since January (0-11) */
#define TM_YEAR 28 /* years since 1900 */
#define TM_WDAY 32 /* days since Sunday (0-6) */
#define TM_YDAY 36 /* days since January 1st (0-365) */
#define TM_ISDST 40 /* flag for daylight savings time */
/* (non-zero if alt. timezone in effect) */
#define MIDNGT 44
...
dtitos(time.0, ch.TM)
load(int.TM_HOUR, 0)
dtstoi(ch.TM, int.MIDNGT)

See also

© 2006 Avaya Inc. All Rights Reserved.