Changeset ce691c51 in rtems
- Timestamp:
- 06/18/98 15:14:48 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 9a6994b4
- Parents:
- bdb1057
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libcsupport/src/__gettod.c
rbdb1057 rce691c51 1 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 2 1 3 #include <rtems.h> 2 4 … … 28 30 29 31 /* 32 * Seconds from January 1, 1970 to January 1, 1988. Used to account for 33 * differences between POSIX API and RTEMS core. 34 */ 35 36 #define POSIX_TIME_SECONDS_1970_THROUGH_1988 \ 37 (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \ 38 (4 * TOD_SECONDS_PER_DAY)) 39 40 /* 30 41 * NOTE: The solaris gettimeofday does not have a second parameter. 31 42 */ … … 36 47 ) 37 48 { 38 rtems_status_code status; 39 rtems_clock_time_value time; 49 rtems_interrupt_level level; 50 rtems_unsigned32 seconds; 51 rtems_unsigned32 microseconds; 40 52 41 53 if ( !tp ) { … … 44 56 } 45 57 46 /* "POSIX" does not seem to allow for not having a TOD */ 47 status = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &time ); 48 if ( status != RTEMS_SUCCESSFUL ) { 49 assert( 0 ); 50 return -1; 51 } 58 /* 59 * POSIX does not seem to allow for not having a TOD so we just 60 * grab the time of day. 61 * 62 * NOTE: XXX this routine should really be in the executive proper. 63 */ 64 65 rtems_interrupt_disable(level); 66 seconds = _TOD_Seconds_since_epoch; 67 microseconds = _TOD_Current.ticks; 68 rtems_interrupt_enable(level); 52 69 53 tp->tv_sec = time.seconds;54 tp->tv_usec = time.microseconds;70 tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988; 71 tp->tv_usec = microseconds * _TOD_Microseconds_per_tick; 55 72 56 73 /* -
c/src/lib/libc/__gettod.c
rbdb1057 rce691c51 1 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 2 1 3 #include <rtems.h> 2 4 … … 28 30 29 31 /* 32 * Seconds from January 1, 1970 to January 1, 1988. Used to account for 33 * differences between POSIX API and RTEMS core. 34 */ 35 36 #define POSIX_TIME_SECONDS_1970_THROUGH_1988 \ 37 (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \ 38 (4 * TOD_SECONDS_PER_DAY)) 39 40 /* 30 41 * NOTE: The solaris gettimeofday does not have a second parameter. 31 42 */ … … 36 47 ) 37 48 { 38 rtems_status_code status; 39 rtems_clock_time_value time; 49 rtems_interrupt_level level; 50 rtems_unsigned32 seconds; 51 rtems_unsigned32 microseconds; 40 52 41 53 if ( !tp ) { … … 44 56 } 45 57 46 /* "POSIX" does not seem to allow for not having a TOD */ 47 status = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &time ); 48 if ( status != RTEMS_SUCCESSFUL ) { 49 assert( 0 ); 50 return -1; 51 } 58 /* 59 * POSIX does not seem to allow for not having a TOD so we just 60 * grab the time of day. 61 * 62 * NOTE: XXX this routine should really be in the executive proper. 63 */ 64 65 rtems_interrupt_disable(level); 66 seconds = _TOD_Seconds_since_epoch; 67 microseconds = _TOD_Current.ticks; 68 rtems_interrupt_enable(level); 52 69 53 tp->tv_sec = time.seconds;54 tp->tv_usec = time.microseconds;70 tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988; 71 tp->tv_usec = microseconds * _TOD_Microseconds_per_tick; 55 72 56 73 /* -
cpukit/libcsupport/src/__gettod.c
rbdb1057 rce691c51 1 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 2 1 3 #include <rtems.h> 2 4 … … 28 30 29 31 /* 32 * Seconds from January 1, 1970 to January 1, 1988. Used to account for 33 * differences between POSIX API and RTEMS core. 34 */ 35 36 #define POSIX_TIME_SECONDS_1970_THROUGH_1988 \ 37 (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \ 38 (4 * TOD_SECONDS_PER_DAY)) 39 40 /* 30 41 * NOTE: The solaris gettimeofday does not have a second parameter. 31 42 */ … … 36 47 ) 37 48 { 38 rtems_status_code status; 39 rtems_clock_time_value time; 49 rtems_interrupt_level level; 50 rtems_unsigned32 seconds; 51 rtems_unsigned32 microseconds; 40 52 41 53 if ( !tp ) { … … 44 56 } 45 57 46 /* "POSIX" does not seem to allow for not having a TOD */ 47 status = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &time ); 48 if ( status != RTEMS_SUCCESSFUL ) { 49 assert( 0 ); 50 return -1; 51 } 58 /* 59 * POSIX does not seem to allow for not having a TOD so we just 60 * grab the time of day. 61 * 62 * NOTE: XXX this routine should really be in the executive proper. 63 */ 64 65 rtems_interrupt_disable(level); 66 seconds = _TOD_Seconds_since_epoch; 67 microseconds = _TOD_Current.ticks; 68 rtems_interrupt_enable(level); 52 69 53 tp->tv_sec = time.seconds;54 tp->tv_usec = time.microseconds;70 tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988; 71 tp->tv_usec = microseconds * _TOD_Microseconds_per_tick; 55 72 56 73 /*
Note: See TracChangeset
for help on using the changeset viewer.