title: warning: conversion to 'double' from 'long int' may alter its value
body: <p>My code is the following:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sys/time.h&gt;
  using namespace std;
  
  int main(int argc, char** argv) {
                  if(argv[0])
                          argc++;
  
                  struct timeval m_timeEnd, m_timeCreate, m_timeStart;
          long mtime, alltime, seconds, useconds;
  
                  gettimeofday(&amp;m_timeStart,NULL);
                  sleep(3);
                  gettimeofday(&amp;m_timeCreate,NULL);
                  sleep(1);
  
          gettimeofday(&amp;m_timeEnd, NULL);
          seconds  = m_timeEnd.tv_sec  - m_timeStart.tv_sec;
          useconds = m_timeEnd.tv_usec - m_timeStart.tv_usec;
  
          mtime = (long) (((seconds) * 1000 + useconds/1000.0) + 0.5);
          seconds = useconds = 0;
          seconds  = m_timeEnd.tv_sec  - m_timeCreate.tv_sec;
          useconds = m_timeEnd.tv_usec - m_timeCreate.tv_usec;
          alltime = (long) (((seconds) * 1000 + useconds/1000.0) + 0.5);
  
          printf("IN=%ld ALL=%ld milsec.\n", mtime, alltime);
  
  }
  </code></pre>
  
  <p>I am compiling with</p>
  
  <blockquote>
    <p>g++ -W -Wall -Wno-unknown-pragmas -Wpointer-arith -Wcast-align
    -Wcast-qual -Wsign-compare -Wconversion -O -fno-strict-aliasing</p>
  </blockquote>
  
  <p>and I have some warnings that I need to eliminate. How?</p>
  
  <pre><code>a1.cpp:21: warning: conversion to 'double' from 'long int' may alter its value
  a1.cpp:21: warning: conversion to 'double' from 'long int' may alter its value
  a1.cpp:25: warning: conversion to 'double' from 'long int' may alter its value
  a1.cpp:25: warning: conversion to 'double' from 'long int' may alter its value
  </code></pre>