use of java.time.zone.ZoneOffsetTransitionRule in project j2objc by google.
the class TCKZoneOffsetTransitionRule method test_toString_floatingWeekBackwards_last.
@Test
public void test_toString_floatingWeekBackwards_last() {
ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
assertEquals(test.toString(), "TransitionRule[Gap +02:00 to +03:00, SUNDAY on or before last day of MARCH at 01:00 WALL, standard offset +02:00]");
}
use of java.time.zone.ZoneOffsetTransitionRule in project j2objc by google.
the class TCKZoneOffsetTransitionRule method test_createTransition_floatingWeek_gap_notEndOfDay.
// -----------------------------------------------------------------------
// createTransition()
// -----------------------------------------------------------------------
@Test
public void test_createTransition_floatingWeek_gap_notEndOfDay() {
ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
ZoneOffsetTransition trans = ZoneOffsetTransition.of(LocalDateTime.of(2000, Month.MARCH, 26, 1, 0), OFFSET_0200, OFFSET_0300);
assertEquals(test.createTransition(2000), trans);
}
use of java.time.zone.ZoneOffsetTransitionRule in project jPOS by jpos.
the class SystemMonitor method generateFrozenDump.
private String generateFrozenDump(String indent) {
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream p = new PrintStream(baos);
String newIndent = indent + " ";
Runtime r = getRuntimeInstance();
ZoneId zi = ZoneId.systemDefault();
Instant instant = Instant.now();
File cwd = new File(".");
String freeSpace = ISOUtil.readableFileSize(cwd.getFreeSpace());
String usableSpace = ISOUtil.readableFileSize(cwd.getUsableSpace());
p.printf("%s OS: %s (%s)%n", indent, System.getProperty("os.name"), System.getProperty("os.version"));
int maxKeyLength = 0;
try {
maxKeyLength = Cipher.getMaxAllowedKeyLength("AES");
} catch (NoSuchAlgorithmException ignored) {
}
p.printf("%s Java: %s (%s) AES-%s%n", indent, System.getProperty("java.version"), System.getProperty("java.vendor"), maxKeyLength == Integer.MAX_VALUE ? "secure" : Integer.toString(maxKeyLength));
p.printf("%s environment: %s%n", indent, Environment.getEnvironment().getName());
p.printf("%s process name: %s%n", indent, processName);
p.printf("%s user name: %s%n", indent, System.getProperty("user.name"));
p.printf("%s host: %s%n", indent, localHost);
p.printf("%s cwd: %s%n", indent, System.getProperty("user.dir"));
p.printf("%s free space: %s%n", indent, freeSpace);
if (!freeSpace.equals(usableSpace))
p.printf("%s usable space: %s%n", indent, usableSpace);
p.printf("%s version: %s (%s)%n", indent, Q2.getVersion(), getRevision());
p.printf("%s instance: %s%n", indent, getInstanceIdAsString());
p.printf("%s uptime: %s (%f)%n", indent, ISOUtil.millisToString(getServerUptimeAsMillisecond()), loadAverage());
p.printf("%s processors: %d%n", indent, r.availableProcessors());
p.printf("%s drift : %d%n", indent, delay);
p.printf("%smemory(t/u/f): %d/%d/%d%n", indent, r.totalMemory() / MB, (r.totalMemory() - r.freeMemory()) / MB, r.freeMemory() / MB);
p.printf("%s encoding: %s%n", indent, Charset.defaultCharset());
p.printf("%s timezone: %s (%s) %s%n", indent, zi, zi.getDisplayName(TextStyle.FULL, Locale.getDefault()), zi.getRules().getOffset(instant).toString());
p.printf("%swatch service: %s%n", indent, getServer().getWatchServiceClassname());
p.printf("%s metrics dir: %s%n", indent, metricsDir);
List<ZoneOffsetTransitionRule> l = zi.getRules().getTransitionRules();
for (ZoneOffsetTransitionRule tr : l) {
p.printf("%s rule: %s%n", indent, tr.toString());
}
ZoneOffsetTransition tran = zi.getRules().nextTransition(instant);
if (tran != null) {
Instant in = tran.getInstant();
p.printf("%s transition: %s (%s)%n", indent, in, in.atZone(zi));
}
p.printf("%s clock: %d %s%n", indent, System.currentTimeMillis() / 1000L, instant);
if (hasSecurityManager())
p.printf("%s sec-manager: %s%n", indent, getSecurityManager());
p.printf("%s thread count: %d%n", indent, mxBean.getThreadCount());
p.printf("%s peak threads: %d%n", indent, mxBean.getPeakThreadCount());
p.printf("%s user threads: %d%n", indent, Thread.activeCount());
showThreadGroup(Thread.currentThread().getThreadGroup(), p, newIndent);
NameRegistrar.getInstance().dump(p, indent, detailRequired);
for (String s : scripts) {
p.printf("%s%s:%n", indent, s);
exec(s, p, newIndent);
}
return baos.toString();
}
use of java.time.zone.ZoneOffsetTransitionRule in project jPOS by jpos.
the class TZCHECK method exec.
public void exec(CLIContext cli, String[] args) throws Exception {
ZoneId zi = ZoneId.systemDefault();
Instant i = Instant.now();
cli.println(" Zone ID: " + zi + " (" + zi.getDisplayName(TextStyle.FULL, Locale.getDefault()) + ") " + zi.getRules().getOffset(i));
cli.println(" UTC: " + i);
ZoneOffsetTransition tran = zi.getRules().nextTransition(i);
if (tran != null) {
Instant in = tran.getInstant();
cli.println(" Next transition: " + in + " (" + in.atZone(zi) + ")");
}
List<ZoneOffsetTransitionRule> l = zi.getRules().getTransitionRules();
for (ZoneOffsetTransitionRule r : l) {
cli.println(" Transition rule: " + r);
}
}
Aggregations