|
Revision 23, 0.8 kB
(checked in by dsandler, 5 years ago)
|
Minimal Swing GUI wrapped around the proxy.
$ java -cp ftproxy.jar net.feedtree.proxyapp.gui.AppGUI -N -V
Might make this the default class for ftproxy.jar, and create a "ftproxy"
shell script which invokes proxyapp.WebProxyClient? instead.
Lots of stuff to fix, including making the hyperlink functional with
JEditorPane.
This feature tracked by ticket #21.
|
| Line | |
|---|
| 1 |
package net.feedtree.util; |
|---|
| 2 |
|
|---|
| 3 |
import java.lang.*; |
|---|
| 4 |
|
|---|
| 5 |
public class TimeUtils { |
|---|
| 6 |
public static String duration(long millis) { |
|---|
| 7 |
long time = millis / 1000; |
|---|
| 8 |
StringBuffer s = new StringBuffer(); |
|---|
| 9 |
if (time > 86400) { |
|---|
| 10 |
long days = time / 86400; |
|---|
| 11 |
if (days > 0) { |
|---|
| 12 |
time = time - 86400 * days; |
|---|
| 13 |
s.append(days); |
|---|
| 14 |
s.append("d"); |
|---|
| 15 |
} |
|---|
| 16 |
} |
|---|
| 17 |
long hours = 0; |
|---|
| 18 |
long minutes = 0; |
|---|
| 19 |
if (time > 3600) { |
|---|
| 20 |
hours = time / 3600; |
|---|
| 21 |
time = time - 3600 * hours; |
|---|
| 22 |
} |
|---|
| 23 |
if (time > 60) { |
|---|
| 24 |
minutes = time / 60; |
|---|
| 25 |
time = time - 60 * minutes; |
|---|
| 26 |
} |
|---|
| 27 |
if (hours > 0) { |
|---|
| 28 |
s.append(hours); |
|---|
| 29 |
s.append("h"); |
|---|
| 30 |
} |
|---|
| 31 |
if (minutes > 0) { |
|---|
| 32 |
if (minutes < 10) s.append("0"); |
|---|
| 33 |
s.append(minutes); |
|---|
| 34 |
s.append("m"); |
|---|
| 35 |
} |
|---|
| 36 |
if (time > 0 || millis < 1000 || s.equals("")) { |
|---|
| 37 |
if (time < 10 && millis > 10000) s.append("0"); |
|---|
| 38 |
s.append(time); |
|---|
| 39 |
s.append("s"); |
|---|
| 40 |
} |
|---|
| 41 |
return s.toString(); |
|---|
| 42 |
} |
|---|
| 43 |
} |
|---|