__time_t type instead of __time64_t in win32/TimeValue.cpp

Hi,

Is it necessary to use the VC6.1+ `__time64_t' type instead of __time_t in win32/TimeValue.cpp?

I'm not sure. Perhaps Jeff Cohen knows as he wrote this.

Reid.

Replace __time_t with time_t in my question. I've compiled function:

std::string TimeValue::toString() const {
  // Alas, asctime is not re-entrant on Windows...

//hb: __time64_t ourTime = this->toEpochTime();
  time_t ourTime = this->toEpochTime();
//hb: char* buffer = ::asctime(::_localtime64(&ourTime));
  char* buffer = ::asctime(::localtime(&ourTime));

  std::string result(buffer);
  return result.substr(0,24);
}

without any complaints. Shouldn't it do with this, Jeff?

Henrik.

I'm not sure. Perhaps Jeff Cohen knows as he wrote this.

Reid.

> Hi,
>
> Is it necessary to use the VC6.1+ `__time64_t' type instead of __time_t in
> win32/TimeValue.cpp?
>
> ---------------
> In file included from
> c:/projects/src/llvm-1/llvm/lib/System/TimeValue.cpp:51:
> c:/projects/build/MinGW/llvm-1-1/lib/System/platform/TimeValue.cpp: In
> member function `std::string llvm::sys::TimeValue::toString() const':
> c:/projects/build/MinGW/llvm-1-1/lib/System/platform/TimeValue.cpp:36:
> error: `__time64_t' undeclared (first use this function)
> c:/projects/build/MinGW/llvm-1-1/lib/System/platform/TimeValue.cpp:36:
> error: (Each undeclared identifier is reported only once for each function
> it appears in.)
> ---------------
>
> Henrik.
>
> =============================================================
> Henrik Bach
> Open Source Developer
>
> e-mail: henrik_bach_llvm at hotmail.com
> =============================================================
> Got Freedom?
> Software Freedom Day 2004 - 28th of August
> http://www.softwarefreedomday.org/
> =============================================================
>
> _________________________________________________________________
> Undgå pop-ups med MSN Toolbar - http://toolbar.msn.dk/ hent den gratis!
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
<< signature.asc >>

Sure it will work... and introduce the (eventually to be dreaded) Y2038 bug. I see no point in introducing a bug that is trivially avoided, even if it won't be hit for another 34 years. However, as mingw cannot avoid this bug (for now), what I will do is conditionally compiled 32-bit variant for mingw.

Henrik Bach wrote: