From 0e1ebb414491fd5417e1fa9129ca08e2be0f4101 Mon Sep 17 00:00:00 2001 From: Kalani Thielen Date: Mon, 13 Apr 2020 17:16:08 -0400 Subject: [PATCH 1/3] catch format string var refs immediately joined --- include/hobbes/storage.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hobbes/storage.H b/include/hobbes/storage.H index 85121c83d..df182ddb2 100644 --- a/include/hobbes/storage.H +++ b/include/hobbes/storage.H @@ -1988,7 +1988,7 @@ template : maxVarRefS(fmt, i+1, 0, 0, maxvr)) : ((fmt[i] >= '0' && fmt[i] <= '9') ? maxVarRefS(fmt, i+1, 1, vri, maxvr) - : maxVarRefS(fmt, i+1, 0, 0, maxV(maxvr, 1+readInt(fmt, vri, i, 0)))); + : maxVarRefS(fmt, i, 0, 0, maxV(maxvr, 1+readInt(fmt, vri, i, 0)))); } template From 9bf934568f515f804983c9ee41b56a1793b1ea83 Mon Sep 17 00:00:00 2001 From: Kalani Thielen Date: Wed, 15 Apr 2020 00:40:19 -0400 Subject: [PATCH 2/3] adam's fixes --- include/hobbes/util/time.H | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/hobbes/util/time.H b/include/hobbes/util/time.H index 8c2f4b4e0..25204ffb8 100644 --- a/include/hobbes/util/time.H +++ b/include/hobbes/util/time.H @@ -111,7 +111,7 @@ inline long readTime(const std::string& x) { int h = h_msu.first.empty() ? 0 : str::to(h_msu.first); int m = m_su.first.empty() ? 0 : str::to(m_su.first); int s = s_u.first.empty() ? 0 : str::to(s_u.first); - int u = s_u.second.empty() ? 0 : str::to(s_u.second); + int u = s_u.second.empty() ? 0 : (str::to(s_u.second) * (s_u.second.size()==3?1000:1)); return mkTime(h,m,s,u); } @@ -119,6 +119,10 @@ inline long readTime(const std::string& x) { inline std::string showTime(long x) { int64_t s = x / (1000 * 1000); int64_t us = x % (1000 * 1000); + if (us < 0) { + s -= 1; + us += 1000L * 1000L; + } static char buf[256]; strftime(buf, sizeof(buf), "%H:%M:%S", localtime(reinterpret_cast(&s))); @@ -194,7 +198,7 @@ inline long readDateTime(const std::string& x) { int h = h_msu.first.empty() ? 0 : str::to(h_msu.first); int min = m_su.first.empty() ? 0 : str::to(m_su.first); int s = s_u.first.empty() ? 0 : str::to(s_u.first); - int u = s_u.second.empty() ? 0 : str::to(s_u.second); + int u = s_u.second.empty() ? 0 : (str::to(s_u.second) * (s_u.second.size()==3?1000:1)); return mkDateTime(y, mon, d, h, min, s, u); } @@ -202,6 +206,10 @@ inline long readDateTime(const std::string& x) { inline std::string showDateTime(long x) { int64_t s = x / (1000L * 1000L); int64_t us = x % (1000L * 1000L); + if (us < 0) { + s -= 1; + us += 1000L * 1000L; + } static char buf[256]; strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", localtime(reinterpret_cast(&s))); From ffbdce298781fbbc0649c84ddbb1e351eb21189d Mon Sep 17 00:00:00 2001 From: Kalani Thielen Date: Thu, 23 Apr 2020 23:50:09 -0400 Subject: [PATCH 3/3] fix a bug in record cons updates where changes to hidden field types were lost --- lib/hobbes/lang/type.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/hobbes/lang/type.C b/lib/hobbes/lang/type.C index 124fbc471..404edc708 100644 --- a/lib/hobbes/lang/type.C +++ b/lib/hobbes/lang/type.C @@ -1077,11 +1077,12 @@ Record::Members consMember(const std::string& lbl, const MonoTypePtr& hty, const if (slot < 0) { r.push_back(Record::Member(lbl, hty)); r.insert(r.end(), tty.begin(), tty.end()); - resetFieldOffsets(&r); } else { r = tty; r[slot].field = lbl; + r[slot].type = hty; } + resetFieldOffsets(&r); return r; }