# serial: src/impl/unix.cc File Reference

serial 1.1.0 Cross-platform, serial port library written in C++

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Defines
Defines | Functions
src/impl/unix.cc File Reference
`#include <stdio.h>`
`#include <string.h>`
`#include <sstream>`
`#include <unistd.h>`
`#include <fcntl.h>`
`#include <sys/ioctl.h>`
`#include <sys/signal.h>`
`#include <errno.h>`
`#include <paths.h>`
`#include <sysexits.h>`
`#include <termios.h>`
`#include <sys/param.h>`
`#include <pthread.h>`
`#include <sys/select.h>`
`#include <sys/time.h>`
`#include <time.h>`
`#include "serial/impl/unix.h"`
Include dependency graph for unix.cc:

## Defines

#define | TIOCINQ 0x541B

## Functions

void | get_time_now (struct timespec &time)

## Define Documentation

#define TIOCINQ 0x541B

## Function Documentation

void get_time_now | ( | struct timespec & | time | ) | `[inline]`

    {
    # ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
      clock_serv_t cclock;
      mach_timespec_t mts;
      host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
      clock_get_time(cclock, &mts);
      mach_port_deallocate(mach_task_self(), cclock);
      time.tv_sec = mts.tv_sec;
      time.tv_nsec = mts.tv_nsec;
    # else
      clock_gettime(CLOCK_REALTIME, &time);
    # endif
    }