Skip to content
Snippets Groups Projects
Select Git revision
  • 1c63d46d6d0ee4c84e37fb9af395ea1d6297f126
  • master default protected
  • prod_dlrg
  • bugifx_configure_once
  • fix_path_chaos
  • feature_mumbleIntegration
6 results

setup.sh

Blame
  • incdate-8.c 860 B
    #include <stdio.h>
    
    typedef struct
    {
      char day, month;
      int year;
    }
    date;
    
    void set_date (date *d)
    {
      d->day = 28;
      d->month = 2;
      d->year = 2100;
    }
    
    void inc_date (date *d)
    {
      d->day++;
      int days_in_month = 31;
      if (d->month == 2)
        {
          int is_leap_year = 0;
          if (d->year % 4 == 0)
            is_leap_year = 1;  /* FIXME */
          if (is_leap_year)
            days_in_month = 29;
          else
            days_in_month = 28;
        }
      else if (d->month == 4 || d->month == 6 || d->month == 9 || d->month == 11)
        days_in_month = 30;
      if (d->day > days_in_month)
        {
          d->month++;
          d->day = 1;
          if (d->month > 12)
            {
              d->year++;
              d->month = 1;
            }
        }
    }
    
    int main (void)
    {
      date today;
      set_date (&today);
      inc_date (&today);
      printf ("%d.%d.%d\n", today.day, today.month, today.year);
      return 0;
    }