]> git.mxchange.org Git - simgear.git/blobdiff - simgear/timing/timezone.cxx
OS-X specific sleep helper, more stable.
[simgear.git] / simgear / timing / timezone.cxx
index 5281158611e97552d6963723c246397b11ab4bc0..4fa6746ca2cd742fc245a10bb440606d7207fd3c 100644 (file)
  *
  ************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
+#include <cstdlib>
 
 #include <simgear/structure/exception.hxx>
 
@@ -131,14 +136,15 @@ SGTimeZoneContainer::SGTimeZoneContainer(const char *filename)
     char buffer[256];
     FILE* infile = fopen(filename, "rb");
     if (!(infile)) {
-        string e = "Unable to open time zone file '";
+        std::string e = "Unable to open time zone file '";
         throw sg_exception(e + filename + '\'');
     }
     
     errno = 0;
 
     while (1) {
-        fgets(buffer, 256, infile);
+        if (0 == fgets(buffer, 256, infile))
+            break;
         if (feof(infile)) {
             break;
         }