2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from many
7 others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 Bacula® is a registered trademark of Kern Sibbald.
18 * See btime.c for defintions.
23 #ifndef __btime_INCLUDED
24 #define __btime_INCLUDED
26 /* New btime definition -- use this */
27 btime_t get_current_btime(void);
28 time_t btime_to_unix(btime_t bt); /* bacula time to epoch time */
29 utime_t btime_to_utime(btime_t bt); /* bacula time to utime_t */
31 int tm_wom(int mday, int wday);
32 int tm_woy(time_t stime);
33 int tm_ldom(int month, int year);
35 char *bstrutime(char *dt, int maxlen, utime_t tim);
36 char *bstrftime(char *dt, int maxlen, utime_t tim);
37 char *bstrftimes(char *dt, int maxlen, utime_t tim);
38 char *bstrftime_ny(char *dt, int maxlen, utime_t tim);
39 char *bstrftime_nc(char *dt, int maxlen, utime_t tim);
40 char *bstrftime_dn(char *dt, int maxlen, utime_t tim);
41 utime_t str_to_utime(char *str);
44 /* =========================================================== */
45 /* old code deprecated below. Do not use. */
47 typedef float64_t fdate_t; /* Date type */
48 typedef float64_t ftime_t; /* Time type */
51 fdate_t julian_day_number; /* Julian day number */
52 ftime_t julian_day_fraction; /* Julian day fraction */
55 /* In arguments and results of the following functions,
56 quantities are expressed as follows.
58 year Year in the Common Era. The canonical
59 date of adoption of the Gregorian calendar
60 (October 5, 1582 in the Julian calendar)
63 month Month index with January 0, December 11.
65 day Day number of month, 1 to 31.
70 extern fdate_t date_encode(uint32_t year, uint8_t month, uint8_t day);
71 extern ftime_t time_encode(uint8_t hour, uint8_t minute, uint8_t second,
72 float32_t second_fraction);
73 extern void date_time_encode(struct date_time *dt,
74 uint32_t year, uint8_t month, uint8_t day,
75 uint8_t hour, uint8_t minute, uint8_t second,
76 float32_t second_fraction);
78 extern void date_decode(fdate_t date, uint32_t *year, uint8_t *month,
80 extern void time_decode(ftime_t time, uint8_t *hour, uint8_t *minute,
81 uint8_t *second, float32_t *second_fraction);
82 extern void date_time_decode(struct date_time *dt,
83 uint32_t *year, uint8_t *month, uint8_t *day,
84 uint8_t *hour, uint8_t *minute, uint8_t *second,
85 float32_t *second_fraction);
87 extern int date_time_compare(struct date_time *dt1, struct date_time *dt2);
89 extern void tm_encode(struct date_time *dt, struct tm *tm);
90 extern void tm_decode(struct date_time *dt, struct tm *tm);
91 extern void get_current_time(struct date_time *dt);
94 #endif /* __btime_INCLUDED */