FATOTIME C-3

NAME

fatotime - convert ASCII to time value

SYNOPSIS

#include <cbase/dtypes.h>

int fatotime (sptr, format, t, size)

char *sptr;

char *format;

TIME *t;

int size;

DESCRIPTION

Fatotime converts a string pointed to by sptr to a TIME value using format to control the conversion. The result of the conversion is stored in the TIME value pointed at by t. Size is the size of the TIME value.

Time values are stored internally as the number of seconds from midnight. Midnight has a value of 1. This format allows comparison of two time values and time arithmetic.

Fatotime first tries to convert sptr with format. If this fails, a standard input format of the form hh[:]mm[:]ss[cycle] is used. The : character can be any punctuation character or none at all. Minutes, mm, are required only if seconds, ss , are entered. In addition, the time cycle, cycle, can also be entered. If entered, cycle is compared case insensitively against the values returned by getfcycle(C-3). The hours range from 1am to noon and 1pm to midnight. Noon is 12pm, and midnight is 12am. If the time cycle is not entered, the time is assumed to be in 24 hour format, i.e., the hours go from 0 to 23.

SEE ALSO

fcountry(C-3), getfcycle(C-3), atotime(C-3)

C/Base Reference Manual Chapter 13, "Formatting Data Values"

DIAGNOSTICS

If an error occurs, fatotime returns a negative number and the contents of t are undefined. The following symbolic error codes are defined in <cbase/dtypes.h>:

FTOOBIG size is not the size of a TIME value (use sizeof function)

FFORMAT format is invalid

FIFORMAT sptr does not contain a valid time format

FEDIT sptr contains an invalid time (such as 02:78:00) or the seconds, minutes or hours are invalid

FINCON sptr is inconsistent (e.g. 13am is inconsistent; the time cycle should be pm)

NOTES

When seconds or minutes are not entered in the standard input format, they are assumed to be zero (and valid).