void old_to_new_date(gcstring& s) { if (! is_old_date(s)) return ; const unsigned char* p = (unsigned char*) s.buf() + 1; DateTime dt = unpack_old_datetime(p); SuDate sudt(dt.date(), dt.time()); sudt.pack(s.buf()); }
bool is_old_date(const gcstring& s) { if (s.size() != 9) return false; const unsigned char* p = (const unsigned char*) s.buf(); if (*p != PACK_DATE) return false; ++p; if (p[0] == 0 && p[1] < 32) return false; // new format already return true; }