Changeset 478dc89 in rtems


Ignore:
Timestamp:
Mar 16, 2018, 6:01:48 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
9b61342
Parents:
0a7a30d
git-author:
Sebastian Huber <sebastian.huber@…> (03/16/18 06:01:48)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/16/18 06:52:45)
Message:

imfs: Use most efficient way to get the time

As a side-effect, this fixes some warnings.

Close #3350.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/imfs.h

    r0a7a30d r478dc89  
    1717#define _RTEMS_IMFS_H
    1818
     19#include <sys/time.h>
    1920#include <limits.h>
    2021
     
    338339}
    339340
     341static inline time_t _IMFS_get_time( void )
     342{
     343  struct bintime now;
     344
     345  /* Use most efficient way to get the time in seconds (CLOCK_REALTIME) */
     346  _Timecounter_Getbintime( &now );
     347
     348  return now.sec;
     349}
     350
    340351static inline void IMFS_update_atime( IMFS_jnode_t *jnode )
    341352{
    342   struct timeval now;
    343 
    344   gettimeofday( &now, 0 );
    345 
    346   jnode->stat_atime = now.tv_sec;
     353  jnode->stat_atime = _IMFS_get_time();
    347354}
    348355
    349356static inline void IMFS_update_mtime( IMFS_jnode_t *jnode )
    350357{
    351   struct timeval now;
    352 
    353   gettimeofday( &now, 0 );
    354 
    355   jnode->stat_mtime = now.tv_sec;
     358  jnode->stat_mtime = _IMFS_get_time();
    356359}
    357360
    358361static inline void IMFS_update_ctime( IMFS_jnode_t *jnode )
    359362{
    360   struct timeval now;
    361 
    362   gettimeofday( &now, 0 );
    363 
    364   jnode->stat_ctime = now.tv_sec;
     363  jnode->stat_ctime = _IMFS_get_time();
    365364}
    366365
    367366static inline void IMFS_mtime_ctime_update( IMFS_jnode_t *jnode )
    368367{
    369   struct timeval now;
    370 
    371   gettimeofday( &now, 0 );
    372 
    373   jnode->stat_mtime = now.tv_sec;
    374   jnode->stat_ctime = now.tv_sec;
     368  time_t now;
     369
     370  now = _IMFS_get_time();
     371
     372  jnode->stat_mtime = now;
     373  jnode->stat_ctime = now;
    375374}
    376375
Note: See TracChangeset for help on using the changeset viewer.