ASF Bugzilla – Attachment 22025 Details for
Bug 45089
tstamp granularity attribute
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
simple implementation of enhancement.
tstamp.java.diff (text/plain), 1.27 KB, created by
Mario Frasca
on 2008-05-28 07:11:35 UTC
(
hide
)
Description:
simple implementation of enhancement.
Filename:
MIME Type:
Creator:
Mario Frasca
Created:
2008-05-28 07:11:35 UTC
Size:
1.27 KB
patch
obsolete
>--- Tstamp.java (revision 643306) >+++ Tstamp.java (working copy) >@@ -46,6 +46,7 @@ > > private Vector customFormats = new Vector(); > private String prefix = ""; >+ private Integer granularity; > > /** > * Set a prefix for the properties. If the prefix does not end with a "." >@@ -59,6 +60,17 @@ > this.prefix += "."; > } > } >+ >+ /** >+ * Set the granularity property in minutes. If used, the timestamp is >+ * rounded to the last instant preceding the current time which is at an >+ * integer multiple of the granularity from the epoch. >+ * >+ * @param granularity >+ */ >+ public void setGranularity(Integer granularity) { >+ this.granularity = granularity; >+ } > > /** > * create the timestamps. Custom ones are done before >@@ -68,6 +80,12 @@ > public void execute() throws BuildException { > try { > Date d = new Date(); >+ if (this.granularity != null) { >+ long seconds = d.getTime() / 1000L; >+ long grain = granularity.intValue() * 60; >+ seconds = (seconds / grain) * grain; >+ d.setTime(seconds * 1000L); >+ } > > Enumeration i = customFormats.elements(); > while (i.hasMoreElements()) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45089
: 22025