@Test public void testTimeZone() { IQEntityTimeHandler iqEntityTimeHandler = new IQEntityTimeHandler(); assertEquals(iqEntityTimeHandler.formatsTimeZone(TimeZone.getTimeZone("GMT-8:00")), "-08:00"); }
String formatsTimeZone(TimeZone tz) { int seconds = Math.abs(tz.getOffset(System.currentTimeMillis())) / 1000; int hours = seconds / 3600; int minutes = (seconds % 3600) / 60; return (tz.getRawOffset() < 0 ? "-" : "+") + String.format("%02d:%02d", hours, minutes); }
IQEntityTimeHandler extends IQHandler implements ServerFeaturesProvider { String formatsTimeZone(TimeZone tz) { int seconds = Math.abs(tz.getOffset(System.currentTimeMillis())) / 1000; int hours = seconds / 3600; int minutes = (seconds % 3600) / 60; return (tz.getRawOffset() < 0 ? "-" : "+") + String.format("%02d:%02d", hours, minutes); } }
IQEntityTimeHandler extends IQHandler implements ServerFeaturesProvider { String formatsTimeZone(TimeZone tz) { int seconds = Math.abs(tz.getOffset(System.currentTimeMillis())) / 1000; int hours = seconds / 3600; int minutes = (seconds % 3600) / 60; return (tz.getRawOffset() < 0 ? "-" : "+") + String.format("%02d:%02d", hours, minutes); } IQEntityTimeHandler(); }
IQEntityTimeHandler extends IQHandler implements ServerFeaturesProvider { String formatsTimeZone(TimeZone tz) { int seconds = Math.abs(tz.getOffset(System.currentTimeMillis())) / 1000; int hours = seconds / 3600; int minutes = (seconds % 3600) / 60; return (tz.getRawOffset() < 0 ? "-" : "+") + String.format("%02d:%02d", hours, minutes); } IQEntityTimeHandler(); @Override IQ handleIQ(IQ packet); @Override IQHandlerInfo getInfo(); @Override Iterator<String> getFeatures(); }
IQEntityTimeHandler extends IQHandler implements ServerFeaturesProvider { String formatsTimeZone(TimeZone tz) { int seconds = Math.abs(tz.getOffset(System.currentTimeMillis())) / 1000; int hours = seconds / 3600; int minutes = (seconds % 3600) / 60; return (tz.getRawOffset() < 0 ? "-" : "+") + String.format("%02d:%02d", hours, minutes); } IQEntityTimeHandler(); @Override IQ handleIQ(IQ packet); @Override IQHandlerInfo getInfo(); @Override Iterator<String> getFeatures();  }