Added new operation to DateService to retrieve UNIX timestamp in seconds as well.
git-svn-id: https://brutex.net/svn/xservices/trunk@71 e7e49efb-446e-492e-b9ec-fcafc1997a86tag-20130205r
parent
84a6d44c62
commit
59059af377
|
@ -47,6 +47,7 @@ public interface DateService {
|
||||||
public static final String SERVICE_NAME = "DateService";
|
public static final String SERVICE_NAME = "DateService";
|
||||||
final String OPERATION_GETDATE = "getDate";
|
final String OPERATION_GETDATE = "getDate";
|
||||||
final String OPERATION_GETTIMESTAMP = "getTimestamp";
|
final String OPERATION_GETTIMESTAMP = "getTimestamp";
|
||||||
|
final String OPERATION_GETTIMESTAMP2 = "getTimestamp2";
|
||||||
final String OPERATION_GETINTIMEZONE = "getInTimezone";
|
final String OPERATION_GETINTIMEZONE = "getInTimezone";
|
||||||
final String OPERATION_FORMATDATE = "formatDate";
|
final String OPERATION_FORMATDATE = "formatDate";
|
||||||
final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced";
|
final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced";
|
||||||
|
@ -81,6 +82,15 @@ public interface DateService {
|
||||||
@WebMethod(operationName=OPERATION_GETTIMESTAMP)
|
@WebMethod(operationName=OPERATION_GETTIMESTAMP)
|
||||||
@WSDLDocumentation(value="Get milliseconds since 01.01.1970 (Unix timestap).")
|
@WSDLDocumentation(value="Get milliseconds since 01.01.1970 (Unix timestap).")
|
||||||
public abstract BigInteger getTimestamp();
|
public abstract BigInteger getTimestamp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get seconds since 01.01.1970.
|
||||||
|
*
|
||||||
|
* @return timestamp seconds
|
||||||
|
*/
|
||||||
|
@WebMethod(operationName=OPERATION_GETTIMESTAMP2)
|
||||||
|
@WSDLDocumentation(value="Get seconds since 01.01.1970 (Unix timestap).")
|
||||||
|
public abstract BigInteger getTimestamp2();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a date time with a different time zone.
|
* Display a date time with a different time zone.
|
||||||
|
|
|
@ -64,8 +64,13 @@ public class DateServiceImpl implements DateService {
|
||||||
public BigInteger getTimestamp() {
|
public BigInteger getTimestamp() {
|
||||||
Date d = new Date();
|
Date d = new Date();
|
||||||
long l = d.getTime();
|
long l = d.getTime();
|
||||||
BigInteger timestamp = new BigInteger(Long.toString(l));
|
return new BigInteger(Long.toString(l));
|
||||||
return timestamp;
|
}
|
||||||
|
|
||||||
|
public BigInteger getTimestamp2() {
|
||||||
|
Date d = new Date();
|
||||||
|
long l = d.getTime()/1000;
|
||||||
|
return new BigInteger(Long.toString(l));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue