summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/adjtime.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-02-07 16:10:45 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-02-21 14:16:41 +0100
commit8f1e8f8f26525a8819c8982a2d2c4e339e9921a0 (patch)
tree956a3d8c2a516e39c7ac84cd5388ccdd150e756c /cpukit/posix/src/adjtime.c
parentkern_ntptime.c: Import from FreeBSD (diff)
downloadrtems-8f1e8f8f26525a8819c8982a2d2c4e339e9921a0.tar.bz2
kern_ntptime.c: Port to RTEMS
Remove previous adjtime() implementation. Update #2348.
Diffstat (limited to '')
-rw-r--r--cpukit/posix/src/adjtime.c93
1 files changed, 0 insertions, 93 deletions
diff --git a/cpukit/posix/src/adjtime.c b/cpukit/posix/src/adjtime.c
deleted file mode 100644
index ec8cb19a2e..0000000000
--- a/cpukit/posix/src/adjtime.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * @file
- *
- * @brief Adjust the Time to Synchronize the System Clock
- * @ingroup POSIXAPI
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define _BSD_SOURCE
-#include <time.h>
-#include <sys/time.h>
-#include <errno.h>
-
-#include <rtems/score/timespec.h>
-#include <rtems/score/threaddispatch.h>
-#include <rtems/score/todimpl.h>
-#include <rtems/config.h>
-#include <rtems/seterr.h>
-
-/**
- * This method was initially added as part of porting NTP to RTEMS.
- * It is a BSD compatability function and now is available on
- * GNU/Linux.
- *
- * At one point there was a static variable named adjustment
- * used by this implementation. I don't see any reason for it
- * to be here based upon the GNU/Linux documentation.
- */
-int adjtime(
- const struct timeval *delta,
- struct timeval *olddelta
-)
-{
- struct timespec delta_as_timespec;
- Status_Control status;
-
- /*
- * Simple validations
- */
- if ( !delta )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
- if ( delta->tv_usec >= TOD_MICROSECONDS_PER_SECOND )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
- /*
- * An adjustment of zero is pretty easy.
- */
- if ( delta->tv_sec == 0 && delta->tv_usec == 0 )
- return 0;
-
- /*
- * Currently, RTEMS does the adjustment in one movement so there
- * is no way an adjustment was currently underway.
- *
- * Given interest, requirements, and sponsorship, a future
- * enhancement would be to adjust the time in smaller increments
- * at each clock tick. Until then, there is no outstanding
- * adjustment.
- */
- if ( olddelta ) {
- olddelta->tv_sec = 0;
- olddelta->tv_usec = 0;
- }
-
- /*
- * convert delta timeval to timespec
- */
- delta_as_timespec.tv_sec = delta->tv_sec;
- delta_as_timespec.tv_nsec = delta->tv_usec * 1000;
-
- /*
- * Now apply the adjustment
- */
- status = _TOD_Adjust( &delta_as_timespec );
- if ( status != STATUS_SUCCESSFUL ) {
- rtems_set_errno_and_return_minus_one( STATUS_GET_POSIX( status ) );
- }
-
- return 0;
-}