"Fossies" - the Fresh Open Source Software Archive

Member "dateutils-0.4.6/test/basic_md_get_yday.c" (19 Mar 2019, 1066 Bytes) of package /linux/privat/dateutils-0.4.6.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #if defined HAVE_CONFIG_H
    2 # include "config.h"
    3 #endif  /* HAVE_CONFIG_H */
    4 #include "strops.h"
    5 #include "strops.c"
    6 #include "token.h"
    7 #include "token.c"
    8 #include "date-core.h"
    9 #include "date-core.c"
   10 #include "dt-locale.h"
   11 #include "dt-locale.c"
   12 
   13 static unsigned int
   14 super(unsigned int res)
   15 {
   16     for (int y = 1917; y < 2299; y++) {
   17         for (int m = 1; m <= 12; m++) {
   18             for (int d = 0; d < 32; d++) {
   19                 unsigned int yd;
   20                 yd = __md_get_yday(y, m, d);
   21                 res += y * m * yd + d;
   22             }
   23         }
   24     }
   25     return res;
   26 }
   27 
   28 #if 0
   29 static unsigned int
   30 hyper(unsigned int hyper)
   31 {
   32     dt_ymd_t x;
   33     for (int y = 1917; y < 4096; y++) {
   34         for (int m = 1; m <= 12; m++) {
   35             for (int d = 0; d < 32; d++) {
   36                 unsigned int yd;
   37                 x.y = y;
   38                 x.m = m;
   39                 x.d = d;
   40                 yd = __ymd_get_yday(x);
   41                 hyper += yd;
   42             }
   43         }
   44     }
   45     return hyper;
   46 }
   47 #endif
   48 
   49 int
   50 main(void)
   51 {
   52     unsigned int supersum = 0;
   53 
   54     for (size_t i = 0; i < 4096; i++) {
   55         supersum += super(supersum);
   56     }
   57     printf("super %u\n", supersum);
   58     if (supersum != 2780223808U) {
   59         return 1;
   60     }
   61     return 0;
   62 }
   63 
   64 /* basic_md_get_yday.c ends here */