Subversion Repositories svn1-original

Rev

Rev 45 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
45 - 1
/*************************************************************************
2
*       Copyright (C) 1995 Embbedded Solutions
3
*                       All rights reserved
4
*
5
* file:     src\ages.c
6
*
7
* purpose:  This module contains routines associated with the
8
*           age calculations
9
*
10
*           As the storage and display of a time is machine dependent so
11
*           these routines may need to be altered
12
*
13
* functions
14
*       age_a                  - Convert time to ascii
15
*       time_fa                 - Convert time to ascii
16
*       conv_time               - Convert hh,mm,ss to time
17
*       get_time                - Read/Edit time from user
18
*
19
* programmer: David Purdie
20
*
21
* revision  date        by      reason
22
*           1-Jul-2008  DDP     Created
23
*                               Simplied the conversion of text to time
24
*
25
**************************************************************************/
26
 
27
#include    <ctype.h>
28
#include    <time.h>
29
#include    "consts.h"
30
#include    "structs.h"
31
#include    "proto.h"
32
 
33
/*========================================================================
34
 *
35
 *  Convert age to ascii
36
 *
37
 *  Purpose:
38
 *      This routine will convert the age ( as held in tim ) into an ascii
39
 *      string. The address of the string is returned to the user. The
40
 *      string is internally static and is of a fixed format
41
 *
42
 *      The string format is
43
 *
44
 *      xxx(null)  - if the age is valid.
45
 *      ***(null)  - if the age is unknown
46
 * 
47
 *
48
 *  Parameters:
49
 *      tim         Time to convert
50
 *
51
 *  Returns:
52
 *      Address of an internal buffer that holds the ascii age string
53
 *
54
 *========================================================================*/
55
 
56
char       *age_a( int age )
57
{
58
    static char buf[] = "-----";              /* Hold return string here */
59
    static char invalid[] = "Undef";          /* Invalid string */
60
 
61
    if ( age <= 0 )
62
    {
63
        return ( invalid );
64
    }
65
    else
66
    {
67
        sprintf( buf, "%4.4d", age );
68
        return ( buf );
69
    }
70
}
71
 
72
/********************************* EOF ***********************************/