4 See btime.c for defintions.
10 Bacula® - The Network Backup Solution
12 Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
14 The main author of Bacula is Kern Sibbald, with contributions from
15 many others, a complete list can be found in the file AUTHORS.
16 This program is Free Software; you can redistribute it and/or
17 modify it under the terms of version two of the GNU General Public
18 License as published by the Free Software Foundation and included
21 This program is distributed in the hope that it will be useful, but
22 WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
31 Bacula® is a registered trademark of Kern Sibbald.
32 The licensor of Bacula is the Free Software Foundation Europe
33 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
34 Switzerland, email:ftf@fsfeurope.org.
38 #ifndef __btime_INCLUDED
39 #define __btime_INCLUDED
41 /* New btime definition -- use this */
42 btime_t get_current_btime(void);
43 time_t btime_to_unix(btime_t bt); /* bacula time to epoch time */
44 utime_t btime_to_utime(btime_t bt); /* bacula time to utime_t */
46 int tm_wom(int mday, int wday);
47 int tm_woy(time_t stime);
49 char *bstrutime(char *dt, int maxlen, utime_t tim);
50 char *bstrftime(char *dt, int maxlen, utime_t tim);
51 char *bstrftimes(char *dt, int maxlen, utime_t tim);
52 char *bstrftime_ny(char *dt, int maxlen, utime_t tim);
53 char *bstrftime_nc(char *dt, int maxlen, utime_t tim);
54 utime_t str_to_utime(char *str);
57 /* =========================================================== */
58 /* old code deprecated below. Do not use. */
60 typedef float64_t fdate_t; /* Date type */
61 typedef float64_t ftime_t; /* Time type */
64 fdate_t julian_day_number; /* Julian day number */
65 ftime_t julian_day_fraction; /* Julian day fraction */
68 /* In arguments and results of the following functions,
69 quantities are expressed as follows.
71 year Year in the Common Era. The canonical
72 date of adoption of the Gregorian calendar
73 (October 5, 1582 in the Julian calendar)
76 month Month index with January 0, December 11.
78 day Day number of month, 1 to 31.
83 extern fdate_t date_encode(uint32_t year, uint8_t month, uint8_t day);
84 extern ftime_t time_encode(uint8_t hour, uint8_t minute, uint8_t second,
85 float32_t second_fraction);
86 extern void date_time_encode(struct date_time *dt,
87 uint32_t year, uint8_t month, uint8_t day,
88 uint8_t hour, uint8_t minute, uint8_t second,
89 float32_t second_fraction);
91 extern void date_decode(fdate_t date, uint32_t *year, uint8_t *month,
93 extern void time_decode(ftime_t time, uint8_t *hour, uint8_t *minute,
94 uint8_t *second, float32_t *second_fraction);
95 extern void date_time_decode(struct date_time *dt,
96 uint32_t *year, uint8_t *month, uint8_t *day,
97 uint8_t *hour, uint8_t *minute, uint8_t *second,
98 float32_t *second_fraction);
100 extern int date_time_compare(struct date_time *dt1, struct date_time *dt2);
102 extern void tm_encode(struct date_time *dt, struct tm *tm);
103 extern void tm_decode(struct date_time *dt, struct tm *tm);
104 extern void get_current_time(struct date_time *dt);
107 #endif /* __btime_INCLUDED */