On Fri, Jul 22, 2022 at 9:10 AM Riccardo (Jack) Lucchetti
<p002264(a)staff.univpm.it> wrote:
a student of mine just let me know that he has problems with the yahoo_get
package on windows, when it comes to downloading data before 1970. This is
a consequence of the fact that our strptime() function behaves differently
on linux and windows. For example, the code
<hansl>
x = strptime("1964-05-11", "%Y-%m-%d")
</hansl>
returns generate a value for x that is -178074000 on linux but -1 on
windows. more generally, windows truncates any date prior to 1970 to -1.
Of course, writing a workaround for the affected package is relatively
simple, but shouldn't we address this inconsistency? Or this is not for
us, and we should just mention this fact in the docs? What do you think?
A little background here. Windows doesn't have strptime(), so libgretl
includes an implementation of it, mostly nabbed from Kungliga Tekniska
Högskolan (Sweden). And It's not strptime that's falling over for
dates prior to 1970. Rather it's mktime(), which is required to
convert the "struct tm" pointer obtained from strptime to "epoch
time"
in seconds. Unfortunately the mktime() included in the Windows CRT (C
runtime) doesn't handle pre-1970 dates. So to get this right on
Windows we'd need an alternative implementation of mktime(). A little
googling suggests this isn't trivial, but maybe we can find or devise
something. If not, then I agree, we should add a warning regarding the
limitations of Windows to the strptime() help.
Allin