mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-09-20 02:57:55 +08:00
Retain a limit on both ends, mark where we might return a null instead.
This commit is contained in:
@@ -894,10 +894,9 @@ mdb_date_to_tm(double td, struct tm *t)
|
|||||||
long yr, q;
|
long yr, q;
|
||||||
const int *cal;
|
const int *cal;
|
||||||
|
|
||||||
// if you want to limit 1900--2700, do this
|
// limit to ~1100AD--2700A to protect from overflow
|
||||||
// but it's not necessary
|
if (td < -1e6 || td > 1e6)
|
||||||
// if (td < 0.0 || td > 1e6) // About 2700 AD
|
return;
|
||||||
// return;
|
|
||||||
|
|
||||||
yr = 1;
|
yr = 1;
|
||||||
day = (long)(td);
|
day = (long)(td);
|
||||||
@@ -947,6 +946,8 @@ mdb_date_to_string(MdbHandle *mdb, const char *fmt, void *buf, int start)
|
|||||||
|
|
||||||
mdb_date_to_tm(td, &t);
|
mdb_date_to_tm(td, &t);
|
||||||
|
|
||||||
|
// check if t is still unchanged, return empty string?
|
||||||
|
|
||||||
strftime(text, mdb->bind_size, mdb->date_fmt, &t);
|
strftime(text, mdb->bind_size, mdb->date_fmt, &t);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
Reference in New Issue
Block a user