| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.schema.GeneralizedTimeSyntax; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | |
| | | // The current time in nanoseconds. |
| | | private static volatile long nanoTime; |
| | | |
| | | // The date formatter that will be used to obtain the generalized time. |
| | | private static SimpleDateFormat generalizedTimeFormatter; |
| | | |
| | | // The date formatter that will be used to obtain the local timestamp. |
| | | private static SimpleDateFormat localTimestampFormatter; |
| | | |
| | |
| | | |
| | | TimeZone utcTimeZone = TimeZone.getTimeZone(TIME_ZONE_UTC); |
| | | |
| | | generalizedTimeFormatter = |
| | | new SimpleDateFormat(DATE_FORMAT_GENERALIZED_TIME); |
| | | generalizedTimeFormatter.setTimeZone(utcTimeZone); |
| | | |
| | | gmtTimestampFormatter = new SimpleDateFormat(DATE_FORMAT_GMT_TIME); |
| | | gmtTimestampFormatter.setTimeZone(utcTimeZone); |
| | | |
| | |
| | | date = calendar.getTime(); |
| | | time = date.getTime(); |
| | | nanoTime = System.nanoTime(); |
| | | generalizedTime = generalizedTimeFormatter.format(date); |
| | | generalizedTime = GeneralizedTimeSyntax.format(date); |
| | | localTimestamp = localTimestampFormatter.format(date); |
| | | gmtTimestamp = gmtTimestampFormatter.format(date); |
| | | hourAndMinute = (calendar.get(Calendar.HOUR_OF_DAY) * 100) + |
| | |
| | | * Operates in a loop, getting the current time and then sleeping briefly |
| | | * before checking again. |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | while (true) |
| | |
| | | date = calendar.getTime(); |
| | | time = date.getTime(); |
| | | nanoTime = System.nanoTime(); |
| | | generalizedTime = generalizedTimeFormatter.format(date); |
| | | generalizedTime = GeneralizedTimeSyntax.format(date); |
| | | localTimestamp = localTimestampFormatter.format(date); |
| | | gmtTimestamp = gmtTimestampFormatter.format(date); |
| | | hourAndMinute = (calendar.get(Calendar.HOUR_OF_DAY) * 100) + |