]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/btime.h
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / lib / btime.h
index 6012b12303fdc14daa4a670e4c1b590e6a98c694..9f5b5d1986ca590d6e93c39c104057eeb9299e56 100644 (file)
@@ -1,12 +1,7 @@
 
 /*  
 
-    Time and date structures and functions.
-    Date and time are always represented internally
-    as 64 bit floating point Julian day numbers and
-    fraction.  The day number and fraction are kept
-    as separate quantities to avoid round-off of
-    day fraction. John Walker
+  See btime.c for defintions.
 
      Version $Id$
 
 #define __btime_INCLUDED
 
 /* New btime definition -- use this */
-extern btime_t get_current_btime(void);
-extern time_t btime_to_etime(btime_t bt);
+btime_t get_current_btime(void);
+time_t btime_to_unix(btime_t bt);   /* bacula time to epoch time */
+utime_t btime_to_utime(btime_t bt); /* bacula time to utime_t */
 
-extern void bstrftime(char *dt, int maxlen, uint32_t tim);
+int tm_wom(int mday, int wday);
+int tm_woy(time_t stime);
+
+char *bstrutime(char *dt, int maxlen, utime_t tim);
+char *bstrftime(char *dt, int maxlen, utime_t tim);
+char *bstrftime_nc(char *dt, int maxlen, utime_t tim);
+utime_t str_to_utime(char *str);
 
 
 /* =========================================================== */
-/*       old code deprecated below. Do not use.               */
+/*        old code deprecated below. Do not use.               */
 
-typedef float64_t fdate_t;            /* Date type */
-typedef float64_t ftime_t;            /* Time type */
+typedef float64_t fdate_t;             /* Date type */
+typedef float64_t ftime_t;             /* Time type */
 
 struct date_time {
-    fdate_t julian_day_number;        /* Julian day number */
+    fdate_t julian_day_number;         /* Julian day number */
     ftime_t julian_day_fraction;       /* Julian day fraction */
 };
 
 /*  In arguments and results of the following functions,
     quantities are expressed as follows.
 
-       year    Year in the Common Era.  The canonical
-               date of adoption of the Gregorian calendar
-               (October 5, 1582 in the Julian calendar)
-               is assumed.
+        year    Year in the Common Era.  The canonical
+                date of adoption of the Gregorian calendar
+                (October 5, 1582 in the Julian calendar)
+                is assumed.
 
-       month   Month index with January 0, December 11.
+        month   Month index with January 0, December 11.
 
-       day     Day number of month, 1 to 31.
+        day     Day number of month, 1 to 31.
 
 */
 
 
 extern fdate_t date_encode(uint32_t year, uint8_t month, uint8_t day);
 extern ftime_t time_encode(uint8_t hour, uint8_t minute, uint8_t second,
-                         float32_t second_fraction);
+                          float32_t second_fraction);
 extern void date_time_encode(struct date_time *dt,
-                            uint32_t year, uint8_t month, uint8_t day,
-                            uint8_t hour, uint8_t minute, uint8_t second,
-                            float32_t second_fraction);
+                             uint32_t year, uint8_t month, uint8_t day,
+                             uint8_t hour, uint8_t minute, uint8_t second,
+                             float32_t second_fraction);
 
 extern void date_decode(fdate_t date, uint32_t *year, uint8_t *month,
-                       uint8_t *day);
+                        uint8_t *day);
 extern void time_decode(ftime_t time, uint8_t *hour, uint8_t *minute,
-                       uint8_t *second, float32_t *second_fraction);
+                        uint8_t *second, float32_t *second_fraction);
 extern void date_time_decode(struct date_time *dt,
-                            uint32_t *year, uint8_t *month, uint8_t *day,
-                            uint8_t *hour, uint8_t *minute, uint8_t *second,
-                            float32_t *second_fraction);
+                             uint32_t *year, uint8_t *month, uint8_t *day,
+                             uint8_t *hour, uint8_t *minute, uint8_t *second,
+                             float32_t *second_fraction);
 
 extern int date_time_compare(struct date_time *dt1, struct date_time *dt2);