SystemCall run(block) can now exit the run if it returns false
[io/quag.git] / libs / basekit / source / Duration.h
blob669053c99070e92de3bcc4b4c11a35b7482224be
1 /*#io
2 docCopyright("Steve Dekorte", 2002)
3 docLicense("BSD revised")
4 */
6 #ifndef DURATION_DEFINED
7 #define DURATION_DEFINED 1
9 #include "Common.h"
10 #include "UArray.h"
11 #include "PortableGettimeofday.h"
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
17 typedef struct
19 double seconds;
20 } Duration;
22 BASEKIT_API Duration *Duration_new(void);
23 BASEKIT_API Duration *Duration_newWithSeconds_(double s);
24 BASEKIT_API Duration *Duration_clone(const Duration *self);
25 BASEKIT_API void Duration_copy_(Duration *self, const Duration *other);
27 BASEKIT_API void Duration_free(Duration *self);
28 BASEKIT_API int Duration_compare(const Duration *self, const Duration *other);
30 // components
32 BASEKIT_API int Duration_years(const Duration *self);
33 BASEKIT_API void Duration_setYears_(Duration *self, double y);
35 BASEKIT_API int Duration_days(const Duration *self);
36 BASEKIT_API void Duration_setDays_(Duration *self, double d);
38 BASEKIT_API int Duration_hours(const Duration *self);
39 BASEKIT_API void Duration_setHours_(Duration *self, double m);
41 BASEKIT_API int Duration_minutes(const Duration *self);
42 BASEKIT_API void Duration_setMinutes_(Duration *self, double m);
44 BASEKIT_API double Duration_seconds(const Duration *self);
45 BASEKIT_API void Duration_setSeconds_(Duration *self, double s);
47 // total seconds
49 BASEKIT_API double Duration_asSeconds(const Duration *self);
50 BASEKIT_API void Duration_fromSeconds_(Duration *self, double s);
52 // strings
54 BASEKIT_API UArray *Duration_asUArrayWithFormat_(const Duration *self, const char *format);
55 BASEKIT_API void Duration_print(const Duration *self);
57 // math
59 BASEKIT_API void Duration_add_(Duration *self, const Duration *other);
60 BASEKIT_API void Duration_subtract_(Duration *self, const Duration *other);
62 #ifdef __cplusplus
64 #endif
65 #endif