Fix Windows (MSVC) compiler warnings

warning C4244: '=': conversion from 'double' to 'time_t',
  possible loss of data

warning C4244: 'return': conversion from 'time_t' to 'long',
  possible loss of data
This commit is contained in:
Albrecht Schlosser 2023-10-16 22:04:12 +02:00
parent 63dc3f2acb
commit e7b790ae31

View File

@ -78,8 +78,8 @@ Fl_Timestamp Fl::now(double offset) {
ts.sec = sec;
ts.usec = usec;
if (offset) {
sec = trunc(offset);
usec = (offset - sec) * 1000000;
sec = (time_t)trunc(offset);
usec = int((offset - sec) * 1000000);
ts.sec += sec;
if (usec + ts.usec >= 1000000) {
ts.sec++;
@ -148,7 +148,7 @@ long Fl::ticks_since(Fl_Timestamp& then) {
\see Fl::ticks_since(Fl_Timestamp& then) \see Fl::now()
*/
long Fl::ticks_between(Fl_Timestamp& back, Fl_Timestamp& further_back) {
return (back.sec-further_back.sec)*60 + (back.usec-further_back.usec)/16666;
return long((back.sec-further_back.sec)*60 + (back.usec-further_back.usec)/16666);
}