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.nfsdb.journal.utils.Dates.java
License:Apache License
public static DateTime utc(long millis) { return new DateTime(millis, DateTimeZone.UTC); }
From source file:com.nfsdb.journal.utils.Dates.java
License:Apache License
public static Interval interval(long start, long end) { if (end < start) { return new Interval(end, start, DateTimeZone.UTC); } else {//from w w w . ja v a2 s. c o m return new Interval(start, end, DateTimeZone.UTC); } }
From source file:com.nfsdb.journal.utils.Dates.java
License:Apache License
public static long toMillis(String date) { return new DateTime(date, DateTimeZone.UTC).getMillis(); }
From source file:com.nfsdb.journal.utils.Dates.java
License:Apache License
public static DateTime utc() { return DateTime.now(DateTimeZone.UTC); }
From source file:com.nfsdb.journal.utils.Dates.java
License:Apache License
public static Interval intervalForDirName(String name, PartitionType partitionType) { switch (partitionType) { case YEAR:/* w ww. j ava 2s .c om*/ return intervalForDate(Dates.utc(name + "-01-01T00:00:00.000Z").getMillis(), partitionType); case MONTH: return intervalForDate(Dates.utc(name + "-01T00:00:00.000Z").getMillis(), partitionType); case DAY: return intervalForDate(Dates.utc(name + "T00:00:00.000Z").getMillis(), partitionType); case NONE: if ("default".equals(name)) { return new Interval(0, Long.MAX_VALUE, DateTimeZone.UTC); } default: throw new JournalUnsupportedTypeException(partitionType); } }
From source file:com.nfsdb.journal.utils.Dates.java
License:Apache License
public static Interval intervalForDate(long timestamp, PartitionType partitionType) { switch (partitionType) { case NONE://from w w w . ja v a 2 s . c om return new Interval(0, Long.MAX_VALUE, DateTimeZone.UTC); default: long lo = intervalStart(timestamp, partitionType); long hi = intervalEnd(lo, partitionType); return new Interval(lo, hi, DateTimeZone.UTC); } }
From source file:com.nfsdb.journal.utils.Dates.java
License:Apache License
public static DateTime utc(String date) { return new DateTime(date, DateTimeZone.UTC); }
From source file:com.nike.cerberus.service.CloudFormationService.java
License:Apache License
/** * Blocking call that waits for a stack change to complete. Times out if waiting more than 30 minutes. * * @param endStatuses Status to end on/*from w w w .j a va 2 s . c o m*/ * @return The final status */ public StackStatus waitForStatus(final String stackId, final HashSet<StackStatus> endStatuses) { DateTime now = DateTime.now(DateTimeZone.UTC).minusSeconds(10); DateTime timeoutDateTime = now.plusMinutes(90); Set<String> recordedStackEvents = Sets.newHashSet(); boolean isRunning = true; StackStatus stackStatus = null; while (isRunning) { try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException e) { logger.warn("Thread sleep interrupted. Continuing...", e); } stackStatus = getStackStatus(stackId); if (endStatuses.contains(stackStatus) || stackStatus == null) { isRunning = false; } if (stackStatus != null) { List<StackEvent> stackEvents = getStackEvents(stackId); stackEvents.sort((o1, o2) -> o1.getTimestamp().compareTo(o2.getTimestamp())); for (StackEvent stackEvent : stackEvents) { DateTime eventTime = new DateTime(stackEvent.getTimestamp()); if (!recordedStackEvents.contains(stackEvent.getEventId()) && now.isBefore(eventTime)) { logger.info(String.format("TS: %s, Status: %s, Type: %s, Reason: %s", Chalk.on(stackEvent.getTimestamp().toString()).yellow(), getStatusColor(stackEvent.getResourceStatus()), Chalk.on(stackEvent.getResourceType()).yellow(), Chalk.on(stackEvent.getResourceStatusReason()).yellow())); recordedStackEvents.add(stackEvent.getEventId()); } } } if (timeoutDateTime.isBeforeNow()) { logger.error("Timed out waiting for CloudFormation completion status."); isRunning = false; } } return stackStatus; }
From source file:com.ning.arecibo.collector.persistent.TimelineEventHandler.java
License:Apache License
@Override public void handle(final Event event) { if (shuttingDown.get()) { eventsReceivedAfterShuttingDown.incrementAndGet(); return;//from w w w. ja v a 2s . com } try { handledEventCount.incrementAndGet(); // Lookup the host id final String hostName = EventsUtils.getHostNameFromEvent(event); final Integer hostId = timelineDAO.getOrAddHost(hostName); // Extract and parse samples final Map<String, Object> samples = EventsUtils.getSamplesFromEvent(event); final Map<Integer, ScalarSample> scalarSamples = new LinkedHashMap<Integer, ScalarSample>(); convertSamplesToScalarSamples(hostId, event.getEventType(), samples, scalarSamples); if (scalarSamples.isEmpty()) { eventsDiscarded.incrementAndGet(); log.warn("Invalid event: " + event); return; } final HostSamplesForTimestamp hostSamples = new HostSamplesForTimestamp(hostId, event.getEventType(), new DateTime(event.getTimestamp(), DateTimeZone.UTC), scalarSamples); if (!replaying.get()) { // Start by saving locally the samples backingBuffer.append(hostSamples); } // Then add them to the in-memory accumulator processSamples(hostSamples); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.ning.arecibo.util.timeline.DateTimeUtils.java
License:Apache License
public static DateTime dateTimeFromUnixSeconds(final int unixTime) { return new DateTime(((long) unixTime) * 1000L, DateTimeZone.UTC); }