List of usage examples for java.time ZoneId systemDefault
public static ZoneId systemDefault()
From source file:org.apache.jena.sparql.function.library.nowtz.java
private static String fromQueryTime(Context cxt) { // In UTC.// ww w .j a va 2 s .c o m Node n = cxt.get(ARQConstants.sysCurrentTime); String x = (n == null) ? DateTimeUtils.nowAsXSDDateTimeString() : n.getLiteralLexicalForm(); ZonedDateTime zdt = dtf.parse(x, ZonedDateTime::from); ZonedDateTime zdtLocal; // Convert to local timezone. (maybe should put the time into context as an Instant?) if (!zoneIdUTC.equals(ZoneId.systemDefault())) zdtLocal = zdt.withZoneSameInstant(ZoneId.systemDefault()); else zdtLocal = zdt; return dtf.format(zdtLocal); }
From source file:org.apache.james.mailbox.elasticsearch.json.MessageToElasticSearchJson.java
@Inject public MessageToElasticSearchJson(TextExtractor textExtractor, IndexAttachments indexAttachments, MailboxManager mailboxManager) { this(textExtractor, ZoneId.systemDefault(), indexAttachments, indexMessageId(mailboxManager)); }
From source file:com.hubrick.vertx.s3.signature.AWS4SignatureBuilder.java
public static AWS4SignatureBuilder builder(final Date date, final String region, final String service) { return builder(ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()), region, service); }
From source file:com.gigglinggnus.controllers.ManageExamsController.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EntityManager em = (EntityManager) request.getSession().getAttribute("em"); Clock clk = (Clock) (request.getSession().getAttribute("clock")); List<Term> terms = Term.getFutureTerms(em, Instant.now(clk)); List<Exam> exams = terms.stream().flatMap(term -> term.getExams().stream()) .filter(exam -> exam.getStatus() == ExamStatus.PENDING).collect(Collectors.toList()); Map<Exam, ArrayList<String>> utilMap = new HashMap(); for (Exam e : exams) { Interval<Instant> examInt = e.getInterval(); LocalDate testDate = examInt.getStart().atZone(ZoneId.systemDefault()).toLocalDate(); LocalDate endDate = examInt.getEnd().atZone(ZoneId.systemDefault()).toLocalDate(); Term t = e.getTerm();/* ww w . j av a 2 s . c o m*/ Map<LocalDate, Long> examUtilMap = new HashMap(); ArrayList<String> examList = new ArrayList(); while (testDate.isBefore(endDate.plusDays(1))) { examList.add(testDate.toString() + "=" + t.utilizationForDay(testDate, clk) + " "); testDate = testDate.plusDays(1); } utilMap.put(e, examList); } request.setAttribute("exams", exams); request.setAttribute("utilList", utilMap); RequestDispatcher rd = request.getRequestDispatcher("/admin/manage-exams.jsp"); rd.forward(request, response); }
From source file:org.jimsey.projects.turbine.fuel.domain.StrategyJson.java
@JsonCreator public StrategyJson(@JsonProperty("date") long date, @JsonProperty("symbol") String symbol, @JsonProperty("market") String market, @JsonProperty("close") double close, @JsonProperty("name") String name, @JsonProperty("action") String action, @JsonProperty("amount") Integer amount, @JsonProperty("position") Integer position, @JsonProperty("cash") Double cash, @JsonProperty("value") Double value, @JsonProperty("timestamp") String timestamp) { this(OffsetDateTime.ofInstant(Instant.ofEpochMilli(date), ZoneId.systemDefault()), market, symbol, close, name, action, amount, position, cash, value, timestamp); }
From source file:com.hotelbeds.hotelapimodel.auto.util.AssignUtils.java
public static ZonedDateTime getZonedDateTime(final Timestamp timestamp) { return timestamp != null ? ZonedDateTime.ofInstant(timestamp.toInstant(), ZoneId.systemDefault()) : null; }
From source file:scouterx.webapp.request.CounterRequestByType.java
private void setTimeAsYmd() { ZoneId zoneId = ZoneId.systemDefault(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); LocalDateTime startDateTime = LocalDateTime.parse(startYmdHms, formatter); LocalDateTime endDateTime = LocalDateTime.parse(endYmdHms, formatter); startTimeMillis = startDateTime.atZone(zoneId).toEpochSecond() * 1000L; endTimeMillis = endDateTime.atZone(zoneId).toEpochSecond() * 1000L; }
From source file:org.ojbc.util.model.rapback.IdentificationResultSearchRequest.java
public void setReportedDateStartLocalDate(LocalDate localDate) { this.reportedDateStartDate = localDate == null ? null : Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); }
From source file:com.gigglinggnus.controllers.AdminClockController.java
/** * * @param request servlet request// w w w .ja va 2 s .c om * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EntityManager em = (EntityManager) request.getSession().getAttribute("em"); String strTime = request.getParameter("systemTime"); LocalDateTime ldTime = LocalDateTime.parse(strTime); Instant instant = ldTime.atZone(ZoneId.systemDefault()).toInstant(); Clock clk = Clock.fixed(instant, ZoneId.systemDefault()); request.getSession().setAttribute("clock", clk); RequestDispatcher rd = request.getRequestDispatcher("/home.jsp"); rd.forward(request, response); }
From source file:de.rkl.tools.tzconv.configuration.PreferencesProvider.java
public ZoneId getPreferredReferenceZoneIdIfSet() { final String preferredReferenceZoneId = applicationPreferences.get(PREFERENCES_KEY_REFERENCE_ZONE_ID, null); return StringUtils.isNotBlank(preferredReferenceZoneId) ? ZoneId.of(preferredReferenceZoneId) : ZoneId.systemDefault(); }