0

Real simple program:

#include <time.h>
main()
{
    timezone;
}

The compile error I'm getting:

error: 'timezone' was not declared in this scope

On my Ubuntu machine this program compiles just fine using the standard time.h that looks just like this. You can find lines that look related to defining timezone...

275 /* Defined in localtime.c.  */
278 extern long int __timezone;     /* Seconds west of UTC.  */
290 # if defined __USE_SVID || defined __USE_XOPEN
292 extern long int timezone;
293 # endif

Now the slightly more complex part where I get the error. I'm trying to build this program with Xilinx ISE to run on an embedded ARM chip. Xilinx provides all the standard C and C++ libraries and headers, such as time.h. But the Xilinx provided time.h doesn't seem to define timezone properly. This is the only line related to timezone:

extern __IMPORT long _timezone;

I'm not completely sure what to make of that. An explanation would be apprecatied. It seems awfully bizarre that a standard library would be implement improperly, even a specialized version optimized for an ARM chip. Does anyone know how to solve this problem?

Mike S
  • 11,329
  • 6
  • 41
  • 76
  • There's no `timezone` in C++. It's a [POSIX thing](http://pubs.opengroup.org/onlinepubs/7908799/xsh/timezone.html). I don't know whether Xilinx claims to provide a POSIX compliant environment, but it is not at all clear why an embedded platform would necessarily know what timezone it's in. – n. m. could be an AI Oct 27 '16 at 23:00
  • @n.m. According to Xilinx website "XSDK includes user-customizable drivers for all supported Xilinx hardware IPs, POSIX compliant kernel library and networking and file handling libraries." Would `time.h` be considered a kernel library? And do you have any guess what `extern __IMPORT long _timezone;` is trying to do? – Mike S Oct 27 '16 at 23:08
  • My guess is that `__IMPORT` indicates that the symbol should be imported from a dynamic library, like `__declspec(dllimport)` for MSVC. – Justin Time - Reinstate Monica Oct 27 '16 at 23:44

0 Answers0