1 /**************************************************************************
2 ** (c) Copyright 1999, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : hour.cpp
7 ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation
8 ** VERSION NUMBER : $Revision: 1.2 $
15 ***************************************************************************
16 ** ADMINISTRATIVE INFORMATION *
17 ********************************
18 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 ** CREATION DATE : Feb 06, 1998
20 ** LAST UPDATE : Oct 16, 1999
21 **************************************************************************/
23 /*****************************
25 Revision 1.2 2002-09-02 06:18:20 arjen
26 Fixed some date and time conversion functions
28 Revision 1.1 2002/07/25 08:01:27 arjen
29 First checkin, AXE release 0.2
31 *****************************/
33 static const char *RCSID = "$Id: hour.cpp,v 1.2 2002-09-02 06:18:20 arjen Exp $";
38 #include "parsedate.h"
42 struct parseddate *pd;
56 tp = localtime(&clock);
58 return hour(tp->tm_hour, tp->tm_min, tp->tm_sec);
61 hour operator+(hour &t1, hour &t2)
65 t.seconds += t2.seconds;
71 t.minutes += t2.minutes;
82 hour hour::operator+=(hour t)
101 hour operator-(hour &t1, hour &t2)
105 t.seconds -= t2.seconds;
112 t.minutes -= t2.minutes;
124 ostream& operator<<(ostream &s, const hour &t)
131 s << t.minutes << ":";
139 istream &operator>>(istream &s, hour &h)
144 s >> H >> c >> M >> c >> S;
153 String hour::format(const char *fmt)
163 strftime(buf, 40, fmt, &t);