Skip to content

Instantly share code, notes, and snippets.

@tsuna
Created August 2, 2011 07:07
Show Gist options
  • Save tsuna/1119725 to your computer and use it in GitHub Desktop.
Save tsuna/1119725 to your computer and use it in GitHub Desktop.
TSDB query start time underflow
diff --git a/src/core/TsdbQuery.java b/src/core/TsdbQuery.java
index 2edd53c..8776e89 100644
--- a/src/core/TsdbQuery.java
+++ b/src/core/TsdbQuery.java
@@ -401,7 +401,8 @@ final class TsdbQuery implements Query {
// but this doesn't really matter.
// Additionally, in case our sample_interval is large, we need to look
// even further before/after, so use that too.
- return getStartTime() - Const.MAX_TIMESPAN * 2 - sample_interval;
+ final long t = getStartTime() - Const.MAX_TIMESPAN * 2 - sample_interval;
+ return t > 0 ? t : 0;
}
/** Returns the UNIX timestamp at which we must stop scanning. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment