Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 240732 Details for
Bug 429959
[tests] create unit tests for "Developer Statistics"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Extended Version of Formatter
DateFormatter.java (text/plain), 1.35 KB, created by
Akif Etkue
on 2014-03-10 18:46:22 EDT
(
hide
)
Description:
Extended Version of Formatter
Filename:
MIME Type:
Creator:
Akif Etkue
Created:
2014-03-10 18:46:22 EDT
Size:
1.35 KB
patch
obsolete
>/** > * Copyright (c) 2013 Timur Achmetow. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * Timur Achmetow - initial API and implementation > */ >package org.eclipse.recommenders.stats.rcp.ui.util; > >import java.util.Date; >import java.util.concurrent.TimeUnit; > >import org.eclipse.osgi.util.NLS; > >public class DateFormatter { > > public final String formatUnit(final Date past, final Date now) { > if (past == null || now == null) { > return null; > } > > final long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() > - past.getTime()); > final long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() > - past.getTime()); > final long days = TimeUnit.MILLISECONDS.toDays(now.getTime() > - past.getTime()); > > if (days > 0) { > if (days == 1) { > return NLS.bind("{0} day ago", days); > } > return NLS.bind("{0} days ago", days); > } else if (hours > 0) { > if (hours == 1) { > return NLS.bind("{0} hour ago", hours); > } > return NLS.bind("{0} hours ago", hours); > } else if (minutes >= 0) { > if (minutes == 1) { > return NLS.bind("{0} minute ago", minutes); > } > return NLS.bind("{0} minutes ago", minutes); > } > return null; > } >}
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 Raw
Actions:
View
Attachments on
bug 429959
:
240697
|
240731
| 240732