"Fossies" - the Fresh Open Source Software Archive

Member "dateutils-0.4.6/test/basic_get_jan01_wday.c" (19 Mar 2019, 684 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 < 2199; y++) {
   17         dt_dow_t w;
   18         w = __get_jan01_wday(y);
   19         res += y * (w == DT_SUNDAY ? 0 : w);
   20     }
   21     return res;
   22 }
   23 
   24 int
   25 main(void)
   26 {
   27     unsigned int supersum = 0;
   28 
   29     for (size_t i = 0; i < 1024 * 1024; i++) {
   30         supersum += super(supersum);
   31     }
   32     printf("super %u\n", supersum);
   33     if (supersum != 4293232620U) {
   34         return 1;
   35     }
   36     return 0;
   37 }
   38 
   39 /* basic_get_jan01_wday.c ends here */