Commit 0a36437cac306b4e2fb5614aa89ef2af0138a748

Authored by Benjamin Renard
1 parent 0962073d

Extend YearDays array

Add extern "C" to DD_time.h functions
src/DDClientLibC/DD_time.c
... ... @@ -16,7 +16,7 @@
16 16 #include <string.h>
17 17 #include <stdarg.h>
18 18  
19   -#define YEARS 56
  19 +#define YEARS 70
20 20 #define STARTYEAR 1970
21 21  
22 22 /*---- Static array of days shift from Jan-1-1970 -------*/
... ... @@ -28,6 +28,8 @@
28 28 * 2005 2006 2007 2008 2009 2010 2011
29 29 * 2012 2013 2014 2015 2016 2017 2018
30 30 * 2019 2020 2021 2022 2023 2024 2025
  31 + * 2026 2027 2028 2029 2030 2031 2032
  32 + * 2033 2034 2035 2036 2037 2038 2039
31 33 */
32 34 static double
33 35 YearDays[YEARS] = { 0.0, 365.0, 730.0, 1096.0, 1461.0, 1826.0, 2191.0,
... ... @@ -37,7 +39,9 @@ static double
37 39 10227.0, 10592.0, 10957.0, 11323.0, 11688.0, 12053.0, 12418.0,
38 40 12784.0, 13149.0, 13514.0, 13879.0, 14245.0, 14610.0, 14975.0,
39 41 15340.0, 15706.0, 16071.0, 16436.0, 16801.0, 17167.0, 17532.0,
40   - 17897.0, 18262.0, 18628.0, 18993.0, 19358.0, 19723.0, 20089.0};
  42 + 17897.0, 18262.0, 18628.0, 18993.0, 19358.0, 19723.0, 20089.0,
  43 + 20454.0, 20819.0, 21184.0, 21550.0, 21915.0, 22280.0, 22645.0,
  44 + 23011.0, 23376.0, 23741.0, 24106.0, 24472.0, 24837.0, 25202};
41 45  
42 46 /*-------------------------------------------------------------
43 47 * DAY_OF_YEAR = monthday[*][month-1]+day_of_month -1
... ...
src/DDClientLibC/INCLUDE/DD_time.h
... ... @@ -12,6 +12,22 @@
12 12  
13 13 typedef char dd_time_t[TIMELENGTH]; /* YYYYDDDHHMMSSMLS */
14 14  
  15 +/*---------------- Backup compability with V.3.0 and earlier ----------*/
  16 +typedef struct { double times; /* time sec from 1970 */
  17 + int year;
  18 + int day;
  19 + int hour;
  20 + int min;
  21 + int sec;
  22 + int msec;
  23 + } dd_tmstr_t ;
  24 +
  25 +typedef enum {DD_TM_UNKNOWN, DD_TM_TIME_INTERVAL, DD_TM_DATE} t_DDTimeKind;
  26 +
  27 +#ifdef __cplusplus
  28 +extern "C" {
  29 +#endif
  30 +
15 31 /* ---------------- Functions prototypes ----------------------*/
16 32 extern double DD_Time2Double(dd_time_t DD_Time);
17 33 /* Convert string to double and return.
... ... @@ -22,15 +38,6 @@ extern char *Double2DD_Time(double Time);
22 38 * allocated INSIDE the library. Thus the value is renoveted each function call.
23 39 */
24 40  
25   -/*---------------- Backup compability with V.3.0 and earlier ----------*/
26   -typedef struct { double times; /* time sec from 1970 */
27   - int year;
28   - int day;
29   - int hour;
30   - int min;
31   - int sec;
32   - int msec;
33   - } dd_tmstr_t ;
34 41  
35 42  
36 43 extern dd_tmstr_t *ReadTime(char *UT); /* Read time from sring and fill static
... ... @@ -45,7 +52,7 @@ extern void WriteFmtTime(dd_tmstr_t *UT,char *UTstring);
45 52  
46 53 extern void SetDouble(dd_tmstr_t *UT); /* Fill double value of dd_tmstr_t */
47 54  
48   -typedef enum {DD_TM_UNKNOWN, DD_TM_TIME_INTERVAL, DD_TM_DATE} t_DDTimeKind;
  55 +
49 56  
50 57 extern void SetInt(dd_tmstr_t *UT); /* Fill int values of dd_tmstr_t */
51 58 extern void SetIntNew(dd_tmstr_t *UT,t_DDTimeKind timeKind);
... ... @@ -57,3 +64,7 @@ extern dd_tmstr_t *UT2double(unsigned *UT); /* Set standard time
57 64 * its pointer
58 65 */
59 66 extern unsigned *Double2UT(double Time); /*Converts Double to Gavrilova array */
  67 +
  68 +#ifdef __cplusplus
  69 +}
  70 +#endif
... ...
src/DDClientLibCpp/DD_time.cc
... ... @@ -17,7 +17,7 @@
17 17 #include <string.h>
18 18 #include <stdarg.h>
19 19  
20   -#define YEARS 56
  20 +#define YEARS 70
21 21  
22 22 /*---- Static array of days shift from Jun-1-1970 -------*/
23 23 /* 1970 1971 1972 1973 1974 1975 1976
... ... @@ -28,6 +28,8 @@
28 28 * 2005 2006 2007 2008 2009 2010 2011
29 29 * 2012 2013 2014 2015 2016 2017 2018
30 30 * 2019 2020 2021 2022 2023 2024 2025
  31 + * 2026 2027 2028 2029 2030 2031 2032
  32 + * 2033 2034 2035 2036 2037 2038 2039
31 33 */
32 34 static double
33 35 YearDays[YEARS] = { 0.0, 365.0, 730.0, 1096.0, 1461.0, 1826.0, 2191.0,
... ... @@ -37,7 +39,9 @@ static double
37 39 10227.0, 10592.0, 10957.0, 11323.0, 11688.0, 12053.0, 12418.0,
38 40 12784.0, 13149.0, 13514.0, 13879.0, 14245.0, 14610.0, 14975.0,
39 41 15340.0, 15706.0, 16071.0, 16436.0, 16801.0, 17167.0, 17532.0,
40   - 17897.0, 18262.0, 18628.0, 18993.0, 19358.0, 19723.0, 20089.0};
  42 + 17897.0, 18262.0, 18628.0, 18993.0, 19358.0, 19723.0, 20089.0,
  43 + 20454.0, 20819.0, 21184.0, 21550.0, 21915.0, 22280.0, 22645.0,
  44 + 23011.0, 23376.0, 23741.0, 24106.0, 24472.0, 24837.0, 25202};
41 45  
42 46 static int monthday[2][12] =
43 47 {
... ...