MCPcopy Index your code
hub / github.com/apache/groovy / getAgo

Method getAgo

src/main/java/groovy/time/TimeDuration.java:123–134  ·  view source on GitHub ↗

Returns the date represented by this duration ago. @return the computed date

()

Source from the content-addressed store, hash-verified

121 * @return the computed date
122 */
123 @Override
124 public Date getAgo() {
125 final Calendar cal = Calendar.getInstance();
126
127 cal.add(Calendar.DAY_OF_YEAR, -this.getDays());
128 cal.add(Calendar.HOUR_OF_DAY, -this.getHours());
129 cal.add(Calendar.MINUTE, -this.getMinutes());
130 cal.add(Calendar.SECOND, -this.getSeconds());
131 cal.add(Calendar.MILLISECOND, -this.getMillis());
132
133 return cal.getTime();
134 }
135
136 /**
137 * Returns a helper for computing dates relative to now.

Callers

nothing calls this directly

Calls 7

getMillisMethod · 0.80
getInstanceMethod · 0.65
addMethod · 0.65
getDaysMethod · 0.45
getHoursMethod · 0.45
getMinutesMethod · 0.45
getSecondsMethod · 0.45

Tested by

no test coverage detected