Title:
[ANeff] ER for: cfloop step precision (date range looping is sometimes imprecise)
| View in TrackerStatus/Resolution/Reason: To Fix//
Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)
Created: 12/14/2012
Components: Language
Versions: 10.0
Failure Type: Enhancement Request
Found In Build/Fixed In Build: Final /
Priority/Frequency: Trivial / Unknown
Locale/System: English / Win All
Vote Count: 0
Currently, cflooping backwards thru minutes (as an example) loses precision. Basically, cfloop's "step" behaves as if it lacks precisionEvaluate() behavior.
Repro:
<cfset startDate = createDateTime(2012,12,14,0,0,0) />
<cfloop from="#startDate#" to="#dateAdd('n', -2750, startDate)#" step="-#createTimeSpan(0,0,1,0)#" index="i">
#dateTimeFormat(i, "yyyy-mm-dd HH:nn:ss")#<br />
</cfloop>
Actual output:
<snip>
2012-12-12 05:26:00
2012-12-12 05:25:00
2012-12-12 05:24:00
2012-12-12 05:22:59 <== precision lost
2012-12-12 05:21:59
2012-12-12 05:20:59
</snip>
Expected output:
<snip>
2012-12-12 05:26:00
2012-12-12 05:25:00
2012-12-12 05:24:00
2012-12-12 05:23:00
2012-12-12 05:22:00
2012-12-12 05:21:00
</snip>
If cfloop's "step" would internally use precisionEvaluate(), then precision would be maintained. Pseudo-example:
<cfset startDate = createDateTime(2012,12,14,0,0,0) />
<cfoutput>#dateTimeFormat(startDate, "yyyy-mm-dd HH:nn:ss")#</cfoutput><br />
<cfloop from="1" to="2749" index="i">
<cfset startDate = precisionEvaluate(startDate-createTimeSpan(0,0,1,0)) />
<cfoutput>#dateTimeFormat(startDate, "yyyy-mm-dd HH:nn:ss")#</cfoutput><br />
</cfloop>
Please run attached file for full repro.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3429216
Reason: BugVerified
External Customer Info:
External Company:
External Customer Name: itisdesign
External Customer Email:
Attachments:
- December 14, 2012 00:00:00: 1_cfloop_step_imprecise.cfm
Comments: