title: Why is time a Real and not an Integer in Modelica
body: <p>Modelica defines time as real (<a href="https://www.modelica.org/documents/ModelicaSpec33.pdf" rel="nofollow noreferrer">sec 3.6.7</a>) </p>
  
  <pre><code>input Real time (final quantity = "Time",
                   final unit     = "s"); 
  </code></pre>
  
  <p>In a solver, when using time parsed from a Modelica text for comparison operations, a tolerance has to be taken into consideration, which makes the comparisons slower (and theoretically somewhat imprecise). Though the parsed time values can be converted to integer manually where appropriate, this involves additional processing time.</p>
  
  <p>What is the reason to represent time as a Real instead of as an Integer (e.g. with <code>unit = "ns"</code> by default)?</p>
  
  <hr>
  
  <p>To give perspective where the question comes from:</p>
  
  <p>The time type of the ISO C standard is unspecified. However on implementations for Posix-compliant systems, time is an integer:</p>
  
  <p>Older ISO C standards define <code>time_t</code> as arithmetic type (<a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf" rel="nofollow noreferrer">sec 7.32.1</a>), so it can be either a real-floating or integer. In C11, <code>time_t</code> is defined as real type (<a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf" rel="nofollow noreferrer">sec 7.27.1</a>), while POSIX requires <code>time_t</code> <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html" rel="nofollow noreferrer">to be an integer type</a>.</p>
  
  <p>For example in gcc Debian 4.9.2-10 <code>time_t</code> is an integer:</p>
  
  <pre><code>typedef long int __time_t;
  typedef __time_t time_t;
  </code></pre>