List of usage examples for org.joda.time DateTimeZone UTC
DateTimeZone UTC
To view the source code for org.joda.time DateTimeZone UTC.
Click Source Link
From source file:com.tales.storage.hbase.translators.BytesToDateTimeTranslator.java
License:Apache License
@Override public Object translate(Object anObject) { Object returnValue;/* w w w.jav a2 s. c o m*/ if (anObject == null) { returnValue = this.nullValue; } else { try { byte[] value = (byte[]) anObject; if (value.length == 0) { returnValue = this.nullValue; } else { long milliseconds = reverse ? Long.MAX_VALUE - Bytes.toLong(value) : Bytes.toLong(value); returnValue = new DateTime(milliseconds, DateTimeZone.UTC); // note: when we saved we lost the timezone, but assume UTC } } catch (ClassCastException e) { throw new TranslationException(e); } } return returnValue; }
From source file:com.tales.storage.hbase.translators.DateTimeToBytesTranslator.java
License:Apache License
@Override public Object translate(Object anObject) { Object returnValue;// ww w .j a v a2 s .co m if (anObject == null) { returnValue = this.nullValue; } else { try { DateTime dateTime = ((DateTime) anObject).toDateTime(DateTimeZone.UTC); // at least make it UTC if we are going to loose timezone long timestamp = reverse ? Long.MAX_VALUE - dateTime.getMillis() : dateTime.getMillis(); // NOTE: this looses timezone information returnValue = Bytes.toBytes(timestamp); } catch (ClassCastException e) { throw new TranslationException(e); } } return returnValue; }
From source file:com.tales.storage.StorageStatus.java
License:Apache License
public void recordGetExecution(int theItemCount, long theExecutionTime) { getItems.addAndGet(theItemCount);//w w w. j av a2s .com getItemAverage.add(theItemCount); getExecutionTime.add(theExecutionTime); lastGet = new DateTime(DateTimeZone.UTC); }
From source file:com.tales.storage.StorageStatus.java
License:Apache License
public void recordPutExecution(int theItemCount, long theExecutionTime) { putItems.addAndGet(theItemCount);//w w w .j a v a2s . com putItemAverage.add(theItemCount); putExecutionTime.add(theExecutionTime); lastPut = new DateTime(DateTimeZone.UTC); }
From source file:com.tales.storage.StorageStatus.java
License:Apache License
public void recordCheckedPutSuccess(long theExecutionTime) { putItems.addAndGet(1);//from w w w . j a v a 2s . co m putItemAverage.add(1); checkedPutSuccesses.addAndGet(1); checkedPutSuccessRate.increment(); checkedPutExecutionTime.add(theExecutionTime); lastCheckedPut = new DateTime(DateTimeZone.UTC); }
From source file:com.tales.storage.StorageStatus.java
License:Apache License
public void recordDeleteExecution(int theItemCount, long theExecutionTime) { deleteItems.addAndGet(theItemCount); deleteItemAverage.add(theItemCount); deleteExecutionTime.add(theExecutionTime); lastDelete = new DateTime(DateTimeZone.UTC); }
From source file:com.talvish.tales.contracts.services.ContractStatus.java
License:Apache License
/** * Records that a request was sent to the contract. */// ww w. j ava 2 s . co m public void recordReceivedRequest() { requests.incrementAndGet(); requestRate.increment(); lastRequest = new DateTime(DateTimeZone.UTC); }
From source file:com.talvish.tales.contracts.services.ContractStatus.java
License:Apache License
/** * Indicates a successful call occurred. */// ww w . j av a 2 s.c o m public void recordSuccess() { successes.incrementAndGet(); successRate.increment(); lastSuccess = new DateTime(DateTimeZone.UTC); }
From source file:com.talvish.tales.contracts.services.ContractStatus.java
License:Apache License
/** * Indicates an unsuccessful call occurred * due to the client sending bad data.// w w w.jav a2 s . c om */ public void recordClientError() { clientErrors.incrementAndGet(); clientErrorRate.increment(); lastClientError = new DateTime(DateTimeZone.UTC); }