xref: /kernel/linux/linux-6.6/tools/include/nolibc/time.h
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-6.6/tools/include/nolibc/
162306a36Sopenharmony_ci/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * time function definitions for NOLIBC
462306a36Sopenharmony_ci * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef _NOLIBC_TIME_H
862306a36Sopenharmony_ci#define _NOLIBC_TIME_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include "std.h"
1162306a36Sopenharmony_ci#include "arch.h"
1262306a36Sopenharmony_ci#include "types.h"
1362306a36Sopenharmony_ci#include "sys.h"
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistatic __attribute__((unused))
1662306a36Sopenharmony_citime_t time(time_t *tptr)
1762306a36Sopenharmony_ci{
1862306a36Sopenharmony_ci	struct timeval tv;
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci	/* note, cannot fail here */
2162306a36Sopenharmony_ci	sys_gettimeofday(&tv, NULL);
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci	if (tptr)
2462306a36Sopenharmony_ci		*tptr = tv.tv_sec;
2562306a36Sopenharmony_ci	return tv.tv_sec;
2662306a36Sopenharmony_ci}
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/* make sure to include all global symbols */
2962306a36Sopenharmony_ci#include "nolibc.h"
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#endif /* _NOLIBC_TIME_H */
32

Indexes created Thu Nov 07 10:32:03 CST 2024