gnunet-android

GNUnet for Android
Log | Files | Refs | README

posix_time.h (1845B)


      1 // Copyright 2022 The BoringSSL Authors
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //     https://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 #ifndef OPENSSL_HEADER_POSIX_TIME_H
     16 #define OPENSSL_HEADER_POSIX_TIME_H
     17 
     18 #include <openssl/base.h>   // IWYU pragma: export
     19 
     20 #include <time.h>
     21 
     22 #if defined(__cplusplus)
     23 extern "C" {
     24 #endif
     25 
     26 
     27 // Time functions.
     28 
     29 
     30 // OPENSSL_posix_to_tm converts a int64_t POSIX time value in |time|, which must
     31 // be in the range of year 0000 to 9999, to a broken out time value in |tm|. It
     32 // returns one on success and zero on error.
     33 OPENSSL_EXPORT int OPENSSL_posix_to_tm(int64_t time, struct tm *out_tm);
     34 
     35 // OPENSSL_tm_to_posix converts a time value between the years 0 and 9999 in
     36 // |tm| to a POSIX time value in |out|. One is returned on success, zero is
     37 // returned on failure. It is a failure if |tm| contains out of range values.
     38 OPENSSL_EXPORT int OPENSSL_tm_to_posix(const struct tm *tm, int64_t *out);
     39 
     40 // OPENSSL_timegm converts a time value between the years 0 and 9999 in |tm| to
     41 // a time_t value in |out|. One is returned on success, zero is returned on
     42 // failure. It is a failure if the converted time can not be represented in a
     43 // time_t, or if the tm contains out of range values.
     44 OPENSSL_EXPORT int OPENSSL_timegm(const struct tm *tm, time_t *out);
     45 
     46 
     47 #if defined(__cplusplus)
     48 }  // extern C
     49 #endif
     50 
     51 #endif  // OPENSSL_HEADER_POSIX_TIME_H