source: box/trunk/lib/common/BoxTimeToUnix.h @ 217

Revision 217, 868 bytes checked in by martin, 6 years ago (diff)

Set svn:eol-style as appropriate for all files

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    BoxTimeToUnix.h
5//              Purpose: Convert times in 64 bit values to UNIX structures
6//              Created: 2003/10/07
7//
8// --------------------------------------------------------------------------
9
10#ifndef FILEMODIFICATIONTIMETOTIMEVAL__H
11#define FILEMODIFICATIONTIMETOTIMEVAL__H
12
13#ifdef WIN32
14#include <time.h>
15#else
16#include <sys/time.h>
17#endif
18
19#include "BoxTime.h"
20
21inline void BoxTimeToTimeval(box_time_t Time, struct timeval &tv)
22{
23        tv.tv_sec = (long)(Time / MICRO_SEC_IN_SEC_LL);
24        tv.tv_usec = (long)(Time % MICRO_SEC_IN_SEC_LL);
25}
26
27inline void BoxTimeToTimespec(box_time_t Time, struct timespec &tv)
28{
29        tv.tv_sec = (time_t)(Time / MICRO_SEC_IN_SEC_LL);
30        tv.tv_nsec = ((long)(Time % MICRO_SEC_IN_SEC_LL)) * NANO_SEC_IN_USEC;
31}
32
33#endif // FILEMODIFICATIONTIMETOTIMEVAL__H
34
Note: See TracBrowser for help on using the repository browser.