[Tinymux] Build problem - Visual Studio 2005 AMD64
Stephen Dennis
brazilofmux at gmail.com
Thu May 12 17:05:10 EDT 2005
localtime() is only used in timeutil.cpp.
As the assert suggests, Windows only supports non-negative time_t,
however, on 32-bit platforms, it doesn't assert, but it returns -1.
This new assert is a notch higher on the rude scale -- especially
considering that other platforms -do- support time_t over the entire
range, and considering that localtime() -already- supports returning
failure.
In timeutil.cpp, there is a function called test_time_t() where I
attempt to determine range that localtime() supports. In that code, I
depend on localtime() returning failure for anything it doesn't
support.
In C++ programs, certain static constructors are called before main()
is called. Following it through, I can see how CLogFile::CLogFile
called GetLocal which calls UTC2Local which calls
QueryLocalOffsetAtUTC which uses ltaUpperBound and ltaLowerBound (the
two boundaries developed by test_time_t()), but at worst, that would
be an unitialized variable issue. The time it would be converting
through that path would be today's time (which is positive).
But, the issue that you're dealing with is the assert, so one possible
work around is to replace test_time_t() with ltaLowerBound = 0, and
ltaUpperBound = _MAX__TIME64_t and see if that changes the behavior.
If that fixes it, then I'll change test_time_t to test a narrower
range under Windows than under Unix.
Stephen
On 5/12/05, Sean Hunter <downloadcom at dagnabit.org> wrote:
> After fixing a small issue with the compiler in player.cpp (Line 319 -
> strchr((char*)szSetting+1, '$'); instead of strchr(szSetting+1, '$');
> since it complains about converting const char* to char*) it compiles
> fine, but when ran it has some issues. The issue is that it'll fail an
> asert in timloc64.c (microsoft code, unavailable) about 3 times before
> entering main(). The text of the asert is:
>
> File: loctime64.c
> Line: 80
> Expression: ( ( *ptime >= 0 ) && ( *ptime <= _MAX__TIME64_T ) )
>
> If I have the debugger retry, it'll stop execution in time.inl at:
> _CRT_INSECURE_DEPRECATE static __inline struct tm * __CRTDECL
> localtime(const time_t * _Time)
> {
> #pragma warning( push )
> #pragma warning( disable : 4996 )
> Stops here--> return _localtime64(_Time);
> #pragma warning( pop )
> }
>
> And _Time will have the value 0x0012fe20 or -62155741625
> If ignored 2 more times, it'll display the normal command line options
> help and exit.
>
> The code is compiling for x86, AFAIK, and I don't trust my x86 version
> of XP installed to test compiling on there, but will do if you think
> it's necessary.
>
> Any other information you need? I've generally traced the problem to the
> timeutil code I think, and it would make sense.
> This isn't really a major problem, since the majority of people using
> TinyMUX won't be compiling it under VS2005 on WinXP 64-bit, but I'm
> curious if you know what's wrong/how to fix it so I can play with the
> code more on my computer instead of using my FreeBSD box.
>
> Thanks,
> -- Sean Hunter
> _______________________________________________
> Tinymux mailing list
> Tinymux at tinymux.org
> http://www.tinymux.org/mailman/listinfo/tinymux
>
More information about the Tinymux
mailing list