Alin Jerpelea
cd2fcf5252
include: migrate to SPDX identifier
...
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-04 08:18:42 +08:00
anjiahao
3fdff878bc
libc:Add macro restrictions to code that uses floating point numbers
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-21 13:33:45 +08:00
fangxinyong
891e05d99a
include: move clockid_t and time[r]_t define to sys/types.h
...
POSIX Standard: Primitive System Data Types
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-19 09:08:40 +03:00
yanghuatao
2529f371ee
change clockid_t type from uint8_t to int
...
make the clock_getres pass the ltp/open_posix_testsuite/clock_getres testcases, posix has no explain about clockid_t type, referrence linux: 858fd168a9/include/linux/types.h (L27)
and 858fd168a9/include/uapi/asm-generic/posix_types.h (L96)
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-07-11 22:36:23 +08:00
guoshichao
bc084a8505
sched/clock/clock_getcpuclockid: add clock_getcpuclockid implementation
...
1. the implementation can pass the full
ltp/open_posix_testsuite/clock_getcpuclockid testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getcpuclockid.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-05 00:32:11 +08:00
Xiang Xiao
7990f90915
Indent the define statement by two spaces
...
follow the code style convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 09:52:08 -03:00
simbit18
b1404f486e
include: Fix nxstyle errors
...
error: Long line found
2023-05-04 02:07:01 +08:00
YAMAMOTO Takashi
892ecb4e40
Make 64-bit time_t unsigned
...
* 32-bit time_t should be unsigned because otherwise it wraps too
soon. (in 2038)
* 64-bit time_t should be unsigned because it should be consistent
within NuttX.
* While signed time_t seems more popular among other OSes, the
consisitency within NuttX outweighs, IMO.
2023-02-27 23:55:52 +08:00
Xiang Xiao
37b8748f17
time.h: Add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID definition
...
see the spec here:
https://pubs.opengroup.org/onlinepubs/000095399/functions/clock_getres.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-26 13:00:23 +02:00
Xiang Xiao
fd0d6a9bf5
compiler.h: Add _ between format|printf|syslog|scanf|strftime and like
...
align with other macro naming style
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-21 01:05:19 +02:00
Xiang Xiao
942513cd37
time: Typedef time_t to int64_t if CONFIG_SYSTEM_TIME64 is defined
...
to handle 2038 problem correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-20 22:17:52 +02:00
Richard Tucker
e8ac5c44f4
libc/time: rearrange itimerspec struct elements
...
Aligns with the linux definition of itimerspec
2022-06-03 13:04:25 +08:00
anjiahao
e6f77aeb9a
libc/lib_strptime:change code format & add notes
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-04-13 10:16:42 +08:00
liuhaitao
366c25682c
libc/time: add strptime porting support
...
lib_strptime.c copies from android bionic/libc/tzcode.
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-04-13 10:16:42 +08:00
Xiang Xiao
f1ed349dd9
sched/clock: Remove CLOCK_MONOTONIC option from Kconfig
...
here is the reason:
1.clock_systime_timespec(core function) always exist regardless the setting
2.CLOCK_MONOTONIC is a foundamental clock type required by many places
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-23 01:21:26 +08:00
Xiang Xiao
cdc781bdfd
libc: Implement local_t related functions
...
since local_t isn't really implemented on NuttX,
we can simply redirect to the non-locale version.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-30 09:43:26 -03:00
Xiang Xiao
ae9b5fd306
Replace mktime with timegm in rtc and fs driver
...
since kernel component should use UTC instead local time
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icf939e1ab0af8e577105f539d2553bc67b3b3d10
2021-06-23 13:43:32 -03:00
Xiang Xiao
b1cd825cac
libc/time: Implement timegm function
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id988ae077cf54597b2522546c4309b66416b8b0e
2021-06-23 13:43:32 -03:00
Alin Jerpelea
9b9be7e1f0
include: Author: Gregory Nutt: update licenses to Apache 2.0
...
Update files from Gregory Nutt to Apache 2.0 license.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-04 03:33:58 -08:00
Xiang Xiao
985f33e42c
time.h: Sprinkle strftime format attribute
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 16:39:24 +08:00
chao.an
8ac184633b
clock/time: add CLOCK_BOOTTIME definition
...
Change-Id: I1adc0445dcdd8284d11aec44bd67b447b2b0490f
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-10 06:40:47 -06:00
chao.an
06e78dc883
libc/time: redirect timegm(3) to mktime(3)
...
See the reference here:
https://man7.org/linux/man-pages/man3/timegm.3.html
Change-Id: Ic583b1bd5c7da02086aef7ff043003e402faa4d4
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 01:04:17 -07:00
chao.an
b8fa1e51d8
time/tm: add "tm_zone" member into tm
...
base/time/time_exploded_posix.cc:190:14: error: ‘struct tm’ has no member named ‘tm_zone’; did you mean ‘tm_mon’?
190 | timestruct.tm_zone = nullptr; // not a POSIX field, so mktime/timegm ignore
| ^~~~~~~
| tm_mon
Change-Id: I9f93e63b50c0692a7a2bfc47abd9d07aa2c8e8db
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 20:03:05 -07:00
Xiang Xiao
6670bc2b27
libc/time: Implement tm::tm_gmtoff field
...
defined by BSD and GNU library extension:
https://www.gnu.org/software/libc/manual/html_node/Broken_002ddown-Time.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I33113bc322f038a3602880db4fb9cf93001947ac
2020-08-21 07:48:52 -03:00
Xiang Xiao
e1ecb3e27c
libc: Don't define localtime[_r] to macro when CONFIG_LIBC_LOCALTIME not define
...
since libc++ declare these function in ctime by:
using ::localtime[_r];
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic0bb68b44c0cab838ab7cc34baee2aaa3ca8a9b5
2020-07-19 19:35:21 -07:00
Xiang Xiao
60fe0a0f96
libc: Refine the inline handling
...
1.Remove CONFIG_HAVE_INLINE macro
2.Change the ANSI C function to normal function
3.Other simple non ANSI function to macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-04 11:10:29 +09:00
Xiang Xiao
a7174cee30
libc: Unify the selection of inline or macro
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I44a26550ff856af07d2d96a6f0a6066f988d6da3
2020-06-02 09:32:25 -06:00
Xiang Xiao
d1343df68f
libc/time: Implement timespec_get for C11
...
https://en.cppreference.com/w/c/chrono/timespec_get
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3eb19c687cb0dc905380b10c931d66e8bb20ac55
2020-06-01 07:10:50 -06:00
Xiang Xiao
80277d1630
Refine the preprocessor conditional guard style ( #190 )
2020-01-31 19:07:39 +01:00
Xiang Xiao
1e3f457c9e
Remove TIME_EXTENDED option to more conform C standard
...
Gregory Nutt <gnutt@nuttx.org>
Run all .c and .h files modified in this PR through nxstyle and correct all coding standard problems.
Xiang Xiao <xiaoxiang@xiaomi.com>
Remove TIME_EXTENDED option to more conform C standard
Note: the code/data size increment is small
2020-01-23 08:17:22 -06:00
Gregory Nutt
35ee844590
sched/signal/sig_nanosleep.c and libc/time/lib_nanosleep.c: Implement clock_nanosleep(). nanosleep() is now reduced to a libc wrapper around clock_nanosleep().
2017-11-11 17:44:59 -06:00
Sebastien Lorquet
51596dc457
Updata difftime. Add a version of difftime for the case where the platform does not support type double
2016-08-25 08:00:50 -06:00
Sebastien Lorquet
a626ba5b70
libc/time: This commit adds the difftime() function. Since the function returns a double, I have isolated it in a CONFIG_LIBC_DIFFTIME option (It also depends on the toolchain-dependent CONFIG_HAVE_DOUBLE so is not available on tiny platforms).
2016-08-24 15:43:57 -06:00
Manuel Stühn
4350b0ba0c
Move macros timeradd() and friends from time.h to sys/time.h.
2015-12-24 07:09:39 -06:00
Gregory Nutt
7110634a38
Trivial typo fix in a comment
2015-12-23 16:09:49 -06:00
Gregory Nutt
5d84cd5d11
Improve a few comments
2015-12-23 15:17:16 -06:00
Manuel Stühn
3002023798
time.h: Add timeradd(), timersub(), timerclear(), timerisset(), and timercmp() as macros. These are non-POSIX interfaces, but included in most BSD deriviatives, included Linux. From Manuel Stühn
2015-12-23 15:13:01 -06:00
Gregory Nutt
e5f27f5865
Fix some conditional compilation. CONFIG_LIBC_LOCALTIME should be checked in most of the same places wehre CONFIG_TIME_EXTENDED is checked
2015-11-25 12:51:45 -06:00
Gregory Nutt
bf9e1943a4
Clean up and review of header files for conformance to standards
2015-06-12 18:07:47 -06:00
Gregory Nutt
718d4d23ad
Add asctime(), asctime_r(), ctime(), and ctime_r().
2015-06-12 11:52:49 -06:00
Gregory Nutt
4608544f65
time.h: Add localtime prototypes; NSH: Correct test for gmtime_r return value
2015-04-21 09:26:18 -06:00
Gregory Nutt
f087e35676
A little localtime clean-up
2015-04-14 10:46:05 -06:00
Gregory Nutt
190c9adef0
Implements CONFIG_TIME_EXTENDED as we discussed relative to providing the last 3 members of the tm struct and support for filling them in and even using the wday in the STM32 RTC. From David Sidrane.
2015-04-08 06:56:43 -06:00
Gregory Nutt
0ec67181c9
Move include/nuttx/timer.h, rtc.h and watchdog.h to include/nuttx/timers/.
2015-04-01 12:37:44 -06:00
Gregory Nutt
60bdc27d25
Fix a couple of typos in recent commit. Found by David Sidrane
2015-02-17 19:21:07 -06:00
Gregory Nutt
f357897b6c
Some files that now include sys/time.h should no longer include timer.h
2015-02-15 16:38:18 -06:00
Gregory Nutt
d6704a1cd7
Suffer the consequences of moving struct timeval to its correct location
2015-02-15 15:18:35 -06:00
Gregory Nutt
fd8d374bfe
Move struct timveval from include/time.h to include/sys/time.h where it belongs.
2015-02-15 13:00:44 -06:00
Gregory Nutt
eed1d6c619
When reading the system timer, don't read a struct timespec, convert it to a fake tick count, then back to a timespec. Remove CLOCK_ACTIVETIME.. it is non-standard, unused, and gets in the way of changes like this
2014-08-15 03:55:41 -06:00
Gregory Nutt
7025465109
Adds support for localtime. From Max Neklyudov
2014-08-12 06:18:22 -06:00