/************************************************************************* * Copyright (C) 1995 Embbedded Solutions * All rights reserved * * file: src\ages.c * * purpose: This module contains routines associated with the * age calculations * * As the storage and display of a time is machine dependent so * these routines may need to be altered * * functions * age_a - Convert time to ascii * time_fa - Convert time to ascii * conv_time - Convert hh,mm,ss to time * get_time - Read/Edit time from user * * programmer: David Purdie * * revision date by reason * 1-Jul-2008 DDP Created * Simplied the conversion of text to time * **************************************************************************/ #include #include #include "consts.h" #include "structs.h" #include "proto.h" /*======================================================================== * * Convert age to ascii * * Purpose: * This routine will convert the age ( as held in tim ) into an ascii * string. The address of the string is returned to the user. The * string is internally static and is of a fixed format * * The string format is * * xxx(null) - if the age is valid. * ***(null) - if the age is unknown * * * Parameters: * tim Time to convert * * Returns: * Address of an internal buffer that holds the ascii age string * *========================================================================*/ char *age_a( int age ) { static char buf[] = "-----"; /* Hold return string here */ static char invalid[] = "Undef"; /* Invalid string */ if ( age <= 0 ) { return ( invalid ); } else { sprintf( buf, "%4.4d", age ); return ( buf ); } } /********************************* EOF ***********************************/