Example usage for org.joda.time LocalTime fromMillisOfDay

List of usage examples for org.joda.time LocalTime fromMillisOfDay

Introduction

In this page you can find the example usage for org.joda.time LocalTime fromMillisOfDay.

Prototype

public static LocalTime fromMillisOfDay(long millisOfDay, Chronology chrono) 

Source Link

Document

Constructs a LocalTime from the specified millis of day using the specified chronology.

Usage

From source file:org.kalypso.ui.rrm.internal.timeseries.operations.ValidateTimestampVisitor.java

License:Open Source License

@Override
public void visit(final IObservationValueContainer container) throws SensorException {
    final IAxis dateAxis = AxisUtils.findDateAxis(container.getAxes());
    final Date date = (Date) container.get(dateAxis);

    final LocalTime local = LocalTime.fromMillisOfDay(date.getTime(), m_timestamp.getChronology());
    final int hour = local.getHourOfDay();

    if (m_hour != hour) {
        final SimpleDateFormat sdf = new SimpleDateFormat(
                Messages.getString(Messages.getString("ValidateTimestampVisitor.0"))); //$NON-NLS-1$
        final TimeZone timezone = MetadataHelper.getTimeZone(container.getMetaData(),
                KalypsoCorePlugin.getDefault().getTimeZone().getID());
        sdf.setTimeZone(timezone);/*from   w ww.  j  a v a 2 s.  com*/

        final String msg = String.format(Messages.getString("ValidateTimestampVisitor.1"), sdf.format(date)); //$NON-NLS-1$
        m_stati.add(IStatus.WARNING, msg);

        m_invalid.add(container.getIndex());
    }
}