[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20040815: building UDUNITS on Cygwin



Dipesh,

>Date: Fri, 13 Aug 2004 14:41:47 -0700
>From: Dipesh Patel <address@hidden>
>Organization: USDA
>To: "'Steve Emmerson'" <address@hidden>
>Subject: RE: 20040813: building UDUNITS on Cygwin 
> Keywords: 200408131907.i7DJ7QaW021117 UDUNITS

The above message contained the following:

>       Sorry to keep bugging you...but I got the 1.12.1 version to compile.
> In the CUSTOMIZE file, when I defined the CPPFLAGS macro, I had set it to
> the following:
> 
> CPPFLAGS=-Df2cFortran -DNDEBUG
> 
> Well, it didn't like the space, so I just took off the -DNDEBUG flag and
> then it worked fine.
> 
>       But, I still have the off by 1 second error.  Here is the test
> program I'm using:
> 
> #include <iostream>
> 
> #if defined(__cplusplus)
> extern "C"
> {
> #include "udunits.h"
> }
> #endif
> 
> using namespace std;
> 
> int main(int argc, char *argv[])
> {
>     int year = 2003;
>     int month = 5;
>     int day = 30;
>     int hour = 10;
>     int min = 35;
>     float sec = 20;
>     string timeUnitStr = "minutes since 1800-01-01 00:00:00";
>     double timeStamp;
>     utUnit timeUnit;
>     
>     // Initialize udunits package
>     utInit("");
>     
>     utScan(timeUnitStr.c_str(), &timeUnit);
> 
>     cout << "BEFORE: " << endl;
>     cout << "Year : " << year << endl;
>     cout << "Month: " << month << endl;
>     cout << "Day  : " << day << endl;
>     cout << "Hour : " << hour << endl;
>     cout << "Min  : " << min << endl;
>     cout << "Sec  : " << sec << endl;
> 
>     utInvCalendar(year, month, day, hour, min, sec,
>                   &timeUnit, &timeStamp);
> 
>     utCalendar(timeStamp, &timeUnit, &year, &month, &day, &hour, &min,
> &sec);   
> 
>     cout << "AFTER: " << endl;
>     cout << "Year : " << year << endl;
>     cout << "Month: " << month << endl;
>     cout << "Day  : " << day << endl;
>     cout << "Hour : " << hour << endl;
>     cout << "Min  : " << min << endl;
>     cout << "Sec  : " << sec << endl;
>     
>     return 0 ;
> }
> 
> I get the following output when I run this program.  Notice that "sec"
> before I run utInvCalendar and utCalendar is "20", but after I lose a second
> and it becomes "19".  Any idea of why this might be happening on Cywin?
> 
> BEFORE:
> Year : 2003
> Month: 5
> Day  : 30
> Hour : 10
> Min  : 35
> Sec  : 20
> AFTER:
> Year : 2003
> Month: 5
> Day  : 30
> Hour : 10
> Min  : 35
> Sec  : 19

If you increase the precision with wich the "sec" variable is printed,
does the difference decrease?

Regards,
Steve Emmerson


pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy