title: C - Counting minutes from a specific date
body: <p>I need to calculate how many minutes have passed since a certain date (1600), but I do not always get the results I would expect.The variable minutes is equal to zero and is of type long long int.For example, for the date 2:18 10/14/1900, I will present 158093418 instead of 158197098, etc .</p>
  <pre><code>#include &lt;stdio.h&gt;
   
  int leapYear (int y) {
      if ( y % 4 == 0 &amp;&amp; ( y % 100 != 0 || y % 400 == 0 ))
          return 1;
      return 0;
  }
  
  void zjistiDny (int y, int m, int d, int h, int i, long long int *minutes)
  {
      int mesic [13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
      long long int days = 0;
      
      for ( int i = 1600; i &lt; y; i++ )
      {
          days += 365;
          if (leapYear(y)){
              days += 1;
          }
  
      }
      
      for ( int i = 1; i &lt;m; i++)
      {
          if (i != 2)
          {
              days += mesic[i];
          }
          else
          {
              if (leapYear(y))
              {
                  days += 1;
              }
              days += mesic[i];
          } 
      
              
      }
  
      days += d;
      *minutes += days*1440;
      *minutes += h*60;
      *minutes += i;
          
  }
  
  int main () 
  {
      long long int minutes1 = 0, minutes2 = 0, minutes = 0;
      int y1 = 1900, m1= 10, d1 = 14, h1 = 2, i1 = 18;
      int y2 = 1950, m2= 11, d2 = 27, h2 = 6, i2 = 53;
      
      zjistiDny(y1,m1,d1,h1,i1,&amp;minutes1);
      zjistiDny(y2,m2,d2,h2,i2,&amp;minutes2);
      
      printf(&quot;minuty1: %lld\n&quot;, minutes1);
      printf(&quot;minuty1: %lld\n&quot;, minutes2);
      return 0;
   }
  </code></pre>