Example usage for org.joda.time DateTimeZone UTC

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

Introduction

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

Prototype

DateTimeZone UTC

To view the source code for org.joda.time DateTimeZone UTC.

Click Source Link

Document

The time zone for Universal Coordinated Time

Usage

From source file:com.barchart.feed.ddf.message.provider.BaseEOD.java

License:BSD License

protected final void decodeDay(final ByteBuffer buffer) {

    final int month = decodeInt(buffer, 2);
    check(buffer.get(), SLASH);//from w w w  .j  a v a  2 s.  c o  m
    final int day = decodeInt(buffer, 2);
    check(buffer.get(), SLASH);
    final int year = decodeInt(buffer, 4);
    check(buffer.get(), COMMA);

    final DateTime date = new DateTime(year, month, day, 0, 0, 0, DateTimeZone.UTC);

    setTradeDay(DDF_TradeDay.fromMillisUTC(date.getMillis()));

}

From source file:com.barchart.feed.ddf.message.provider.BaseEOD.java

License:BSD License

protected final void encodeDay(final ByteBuffer buffer) {

    final DateTime date = new DateTime(getTradeDay().tradeDate().asMillisUTC(), DateTimeZone.UTC);

    encodeInt(date.getMonthOfYear(), buffer, 2);
    buffer.put(SLASH);/*from  ww w  . j  a  va  2  s .  c  o  m*/
    encodeInt(date.getDayOfMonth(), buffer, 2);
    buffer.put(SLASH);
    encodeInt(date.getYear(), buffer, 4);
    buffer.put(COMMA);

}

From source file:com.barchart.feed.ddf.resolver.provider.Status.java

License:BSD License

boolean isPending() {

    if (!wasRunSuccess) {
        return true;
    }//from   w  w w  . j a  v  a 2 s  .c  o  m

    final DateTime previous = new DateTime(lastRunTime);

    final DateTime current = new DateTime(DateTimeZone.UTC);

    final Days days = Days.daysBetween(previous, current);

    final int count = days.getDays();

    if (count > 1) {
        return true;
    }

    return false;

}

From source file:com.barchart.feed.ddf.symbol.enums.DDF_ExpireMonth.java

License:BSD License

/**
 * From millis utc./*from  w  w w  .  jav  a2s . co m*/
 *
 * @param millisUTC the millis utc
 * @return the dD f_ expire month
 */
public static final DDF_ExpireMonth fromMillisUTC(final long millisUTC) {
    final DateTime dateTime = new DateTime(millisUTC, DateTimeZone.UTC);
    return fromDateTime(dateTime);
}

From source file:com.barchart.feed.ddf.symbol.enums.DDF_ExpireYear.java

License:BSD License

/**
 * four digit year value for this enum and millisUTC; for example:
 * /*from   w  ww .  j a v a2  s  .  c o  m*/
 * Y9.getYear("millisUTC-some-time-in-2009") -> 2009
 * 
 * Y9.getYear("millisUTC-some-time-in-2013") -> 2019
 *
 * @param millisUTC the millis utc
 * @return the year this or next
 */
public final int getYearThisOrNext(final long millisUTC) {

    // say, 2
    final int expiYearDigit = code - '0';

    // say, 2013
    final int testYear = new DateTime(millisUTC, DateTimeZone.UTC).getYear();

    // then 3
    final int testYearDigit = testYear % 10;

    // then 2010
    final int testYearDecade = testYear - testYearDigit;

    if (expiYearDigit >= testYearDigit) {
        // same decade : 2012
        return testYearDecade + expiYearDigit;
    } else {
        // next decade : 2022
        return testYearDecade + 10 + expiYearDigit;
    }

}

From source file:com.barchart.feed.ddf.symbol.enums.DDF_ExpireYear.java

License:BSD License

/**
 * Gets the year this or past./*w w w.j  a va  2 s. c o  m*/
 *
 * @param millisUTC the millis utc
 * @return the year this or past
 */
public final int getYearThisOrPast(final long millisUTC) {

    // say 2
    final int expiYearDigit = code - '0';

    // say, 2013
    final int testYear = new DateTime(millisUTC, DateTimeZone.UTC).getYear();

    // then 3
    final int testYearDigit = testYear % 10;

    // then 2010
    final int testYearDecade = testYear - testYearDigit;

    if (expiYearDigit > testYearDigit) {
        // past decade : 2002
        return testYearDecade - 10 + expiYearDigit;
    } else {
        // this decade : 2012
        return testYearDecade + expiYearDigit;
    }

}

From source file:com.barchart.feed.ddf.symbol.enums.DDF_ExpireYear.java

License:BSD License

/**
 * From millis utc./* w  ww . jav a 2 s.  com*/
 *
 * @param millisUTC the millis utc
 * @return the dD f_ expire year
 */
public static final DDF_ExpireYear fromMillisUTC(final long millisUTC) {
    final DateTime dateTime = new DateTime(millisUTC, DateTimeZone.UTC);
    return fromDateTime(dateTime);
}

From source file:com.blackducksoftware.bdio.model.CreationInfo.java

License:Apache License

public static CreationInfo currentTool() {
    Class<?> currentToolClass;
    try {//from   w w w  .j a  v  a 2s .co  m
        currentToolClass = currentToolClass();
    } catch (ClassNotFoundException e) {
        currentToolClass = CreationInfo.class;
    }

    CreationInfo result = new CreationInfo();
    result.setCreated(DateTime.now().withMillisOfSecond(0).withZone(DateTimeZone.UTC));
    result.setCreator(ImmutableList.of(Joiner.on('-').skipNulls().appendTo(new StringBuilder("Tool: "),
            firstNonNull(currentToolClass.getPackage().getImplementationTitle(),
                    currentToolClass.getSimpleName()),
            currentToolClass.getPackage().getImplementationVersion()).toString()));
    return result;
}

From source file:com.blackducksoftware.integration.hub.cli.SimpleScanService.java

License:Apache License

/**
 * This method can be overridden to provide a more appropriate directory name for the logs of a specific scan
 * execution.//  w w  w  .  j a v a2s  . c o m
 */
public String getSpecificScanExecutionLogDirectory() {
    DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd_HH-mm-ss-SSS").withZoneUTC();
    String timeString = DateTime.now().withZone(DateTimeZone.UTC).toString(dateTimeFormatter);
    return timeString;
}

From source file:com.blacklocus.logback.s3.JsonEncoder.java

License:Open Source License

String _doLayout(E eventObject) {
    try {//  ww w .j  a v a  2s .co m

        if (eventObject instanceof ILoggingEvent) {
            ILoggingEvent e = (ILoggingEvent) eventObject;
            RawLog.Builder builder = RawLog.newBuilder().setLoggerName(e.getLoggerName())
                    .setLogLevel(LogLevel.valueOf(e.getLevel().toString()))
                    .setLogDateTime(new DateTime(e.getTimeStamp()).withZone(DateTimeZone.UTC).toString())
                    .setFormat(e.getMessage()).setArgs(stringify(e.getArgumentArray()));

            Map<String, String> mdc = e.getMDCPropertyMap();
            Map<CharSequence, CharSequence> mdcCopy = new HashMap<>(mdc.size());
            for (Map.Entry<String, String> entry : mdc.entrySet()) {
                mdcCopy.put(entry.getKey(), entry.getValue());
            }
            builder.setContext(mdcCopy);

            if (null != renderPatternLayout) {
                String rendered = renderPatternLayout.doLayout(e);
                builder.setRendered(rendered);
            }

            if (lineNumbers) {
                String lineNumber = new LineOfCallerConverter().convert(e);
                if (!CallerData.NA.equals(lineNumber)) {
                    builder.setLineNumber(Integer.valueOf(lineNumber));
                }
            }

            RawLog rawLog = builder.build();
            return rawLog.toString() + NEW_LINE;
        }

    } catch (Exception e) {
        debug(e);
    }

    return null; // hmmmmmm
}