OLD | NEW |
| (Empty) |
1 /* | |
2 * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 * contributor license agreements. See the NOTICE file distributed with | |
4 * this work for additional information regarding copyright ownership. | |
5 * The ASF licenses this file to You under the Apache License, Version 2.0 | |
6 * (the "License"); you may not use this file except in compliance with | |
7 * the License. You may obtain a copy of the License at | |
8 * | |
9 * http://www.apache.org/licenses/LICENSE-2.0 | |
10 * | |
11 * Unless required by applicable law or agreed to in writing, software | |
12 * distributed under the License is distributed on an "AS IS" BASIS, | |
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 * See the License for the specific language governing permissions and | |
15 * limitations under the License. | |
16 */ | |
17 | |
18 package org.apache.tomcat.jni; | |
19 | |
20 /** Time | |
21 * | |
22 * @author Mladen Turk | |
23 */ | |
24 public class Time { | |
25 | |
26 /** number of microseconds per second */ | |
27 public static final long APR_USEC_PER_SEC = 1000000L; | |
28 /** number of milliseconds per microsecond */ | |
29 public static final long APR_MSEC_PER_USEC = 1000L; | |
30 | |
31 /** @return apr_time_t as a second */ | |
32 public static long sec(long t) | |
33 { | |
34 return t / APR_USEC_PER_SEC; | |
35 } | |
36 | |
37 /** @return apr_time_t as a msec */ | |
38 public static long msec(long t) | |
39 { | |
40 return t / APR_MSEC_PER_USEC; | |
41 } | |
42 | |
43 /** | |
44 * number of microseconds since 00:00:00 January 1, 1970 UTC | |
45 * @return the current time | |
46 */ | |
47 public static native long now(); | |
48 | |
49 /** | |
50 * Formats dates in the RFC822 | |
51 * format in an efficient manner. | |
52 * @param t the time to convert | |
53 */ | |
54 public static native String rfc822(long t); | |
55 | |
56 /** | |
57 * Formats dates in the ctime() format | |
58 * in an efficient manner. | |
59 * Unlike ANSI/ISO C ctime(), apr_ctime() does not include | |
60 * a \n at the end of the string. | |
61 * @param t the time to convert | |
62 */ | |
63 public static native String ctime(long t); | |
64 | |
65 /** | |
66 * Sleep for the specified number of micro-seconds. | |
67 * <br><b>Warning :</b> May sleep for longer than the specified time. | |
68 * @param t desired amount of time to sleep. | |
69 */ | |
70 public static native void sleep(long t); | |
71 | |
72 } | |
OLD | NEW |