#15 dbd_parse_datetime uses time_t

v1.0 (example)
wont-fix
None
5
2013-10-06
2013-09-17
John Ralls
No

Which most systems, even 64-bit ones, still define as a 32-bit int, which overflows in 2038. This is a widely-known bug.

25 years might seem like a long time away, but if you got a 30 year mortgage recently, you can't use dbi_conn_result_get_datetime() to retrieve the end-date from a database.

Discussion

  • Markus Hoenicka

    Markus Hoenicka - 2013-10-05
    • status: open --> wont-fix
    • assigned_to: Markus Hoenicka
     
  • Markus Hoenicka

    Markus Hoenicka - 2013-10-05

    According to the link that you provided there is no one-size-fits-all solution to this problem. I suggest using an OS which defines time_t as a 64-bit integer. My 64-bit FreeBSD box does so, and NetBSD and OpenBSD even provide 64-bit time_t on their 32-bit OS versions. I don't know how Linux deals with this problem, but you should be able to find an OS that works even for your mortgage calculations.

     
  • John Ralls

    John Ralls - 2013-10-05

    Wrong answer from a library provider. I guess we (Gnucash) will have to find a different SQL abstraction library, because we're not going to drop support for the OSes that most of them use.

     
  • Markus Hoenicka

    Markus Hoenicka - 2013-10-05

    ...or suggest a fix that works on all supported OSes without breaking backwards compatibility.

     
  • John Ralls

    John Ralls - 2013-10-06

    Should be pretty simple: You just need to pinch the 64-bit gmtime code from FreeBSD. It's all implementation detail in libdbi, because your time function returns a struct tm, not a time_t, so it's transparent to callers as long as it works.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks