/** * Sets RRD's starting timestamp. * * @param gc starting date */ public void setStartTime(Calendar gc) { this.startTime = Util.getTimestamp(gc); }
/** * Sets RRD's starting timestamp. * * @param date starting date */ public void setStartTime(Date date) { this.startTime = Util.getTimestamp(date); }
/** * Creates new DataProcessor object for the given time span. Ending date may be set to null. * In that case, the class will try to find optimal ending date based on the last update time of * RRD files processed with the {@link #processData()} method. * * @param d1 Starting date * @param d2 Ending date */ public DataProcessor(Date d1, Date d2) { this(Util.getTimestamp(d1), d2 != null ? Util.getTimestamp(d2) : 0); }
/** * Sets RRD's starting timestamp. * * @param gc starting date */ public void setStartTime(Calendar gc) { this.startTime = Util.getTimestamp(gc); }
/** * Returns timestamp (unix epoch) for the given year, month and day. * * @param year Year * @param month Month (zero-based) * @param day Day in month * @return Corresponding timestamp */ public static long getTimestamp(int year, int month, int day) { return Util.getTimestamp(year, month, day, 0, 0); }
/** * Creates new DataProcessor object for the given time span. Ending date may be set to null. * In that case, the class will try to find optimal ending date based on the last update time of * RRD files processed with the {@link #processData()} method. * * @param gc1 Starting Calendar date * @param gc2 Ending Calendar date */ public DataProcessor(Calendar gc1, Calendar gc2) { this(Util.getTimestamp(gc1), gc2 != null ? Util.getTimestamp(gc2) : 0); }
/** * Returns timestamp (unix epoch) for the given year, month and day. * * @param year Year * @param month Month (zero-based) * @param day Day in month * @return Corresponding timestamp */ public static long getTimestamp(int year, int month, int day) { return Util.getTimestamp(year, month, day, 0, 0); }
/** * Creates new DataProcessor object for the given time span. Ending date may be set to null. * In that case, the class will try to find optimal ending date based on the last update time of * RRD files processed with the {@link #processData()} method. * * @param d1 Starting date * @param d2 Ending date */ public DataProcessor(Date d1, Date d2) { this(Util.getTimestamp(d1), d2 != null ? Util.getTimestamp(d2) : 0); }
/** * Sets RRD's starting timestamp. * * @param date starting date */ public void setStartTime(Date date) { this.startTime = Util.getTimestamp(date); }
/** * Returns timestamp (unix epoch) for the given Calendar object * * @param gc Calendar object * @return Corresponding timestamp (without milliseconds) */ public static long getTimestamp(Calendar gc) { return getTimestamp(gc.getTime()); }
/** * Returns timestamp (unix epoch) for the given Calendar object * * @param gc Calendar object * @return Corresponding timestamp (without milliseconds) */ public static long getTimestamp(Calendar gc) { return getTimestamp(gc.getTime()); }
/** * Sets value for a single XML template variable. Variable name should be specified * without leading '${' and ending '}' placeholder markers. For example, for a placeholder * <code>${start}</code>, specify <code>start</start> for the <code>name</code> parameter. * * @param name variable name * @param value value to be set in the XML template */ public void setVariable(String name, Date value) { setVariable(name, Util.getTimestamp(value)); }
/** * Sets value for a single XML template variable. Variable name should be specified * without leading '${' and ending '}' placeholder markers. For example, for a placeholder * <code>${start}</code>, specify <code>start</code> for the <code>name</code> parameter. * * @param name variable name * @param value value to be set in the XML template */ public void setVariable(String name, Calendar value) { setVariable(name, Util.getTimestamp(value)); }
/** * Sets value for a single XML template variable. Variable name should be specified * without leading '${' and ending '}' placeholder markers. For example, for a placeholder * <code>${start}</code>, specify <code>start</code> for the <code>name</code> parameter. * * @param name variable name * @param value value to be set in the XML template */ public void setVariable(String name, Date value) { setVariable(name, Util.getTimestamp(value)); }
/** * Sets value for a single XML template variable. Variable name should be specified * without leading '${' and ending '}' placeholder markers. For example, for a placeholder * <code>${start}</code>, specify <code>start</start> for the <code>name</code> parameter. * * @param name variable name * @param value value to be set in the XML template */ public void setVariable(String name, Calendar value) { setVariable(name, Util.getTimestamp(value)); }
public void run() { long intervalend = Util.getTimestamp(new Date()); long intervalstart = intervalend - offset - renderInterval; util.createGraph(template, intervalstart, intervalend, templateProperties); } }
private boolean lazyCheck() { // redraw if lazy option is not set or file does not exist if (!gdef.lazy || !Util.fileExists(gdef.filename)) { return false; // 'false' means 'redraw' } // redraw if not enough time has passed long secPerPixel = (gdef.endTime - gdef.startTime) / gdef.width; long elapsed = Util.getTimestamp() - Util.getLastModified(gdef.filename); return elapsed <= secPerPixel; }
private boolean lazyCheck() { // redraw if lazy option is not set or file does not exist if (!gdef.lazy || !Util.fileExists(gdef.filename)) { return false; // 'false' means 'redraw' } // redraw if not enough time has passed long secPerPixel = (gdef.endTime - gdef.startTime) / gdef.width; long elapsed = Util.getTimestamp() - Util.getLastModified(gdef.filename); return elapsed <= secPerPixel; }
/** * Normalize to a probe step, as org.rrd4j.core.Util.normalize But use a * Date argument and return a Date * * @param date A Date to normalize * @param step Step in seconds * @return "Rounded" Date */ public static Date normalize(Date date, long step) { long timestamp = org.rrd4j.core.Util.getTimestamp(date); return org.rrd4j.core.Util.getDate(org.rrd4j.core.Util.normalize(timestamp, step)); }
private long parseDate(String time) { for (SimpleDateFormat parser : parsers) { try { return Util.getTimestamp(parser.parse(time)); } catch (ParseException e) { } } return new TimeParser(time).parse().getTimestamp(); }