Example usage for org.joda.time DateTimeZone isLocalDateTimeGap

List of usage examples for org.joda.time DateTimeZone isLocalDateTimeGap

Introduction

In this page you can find the example usage for org.joda.time DateTimeZone isLocalDateTimeGap.

Prototype

public boolean isLocalDateTimeGap(LocalDateTime localDateTime) 

Source Link

Document

Checks if the given LocalDateTime is within a gap.

Usage

From source file:com.battlelancer.seriesguide.util.TimeTools.java

License:Apache License

/**
 * Handles DST gap (typically a missing clock hour when DST is getting enabled) by moving the
 * time forward in hour increments until the local date time is outside the gap.
 *//*from ww  w. j  a  v a 2 s.  c  om*/
private static LocalDateTime handleDstGap(DateTimeZone showTimeZone, LocalDateTime localDateTime) {
    while (showTimeZone.isLocalDateTimeGap(localDateTime)) {
        // move time forward in 1 hour increments, until outside of the gap
        localDateTime = localDateTime.plusHours(1);
    }
    return localDateTime;
}