Jump to main content
Index
Advanced search
  1. Home
  2. QNX Software Development Platform

    QNX SDP is a cross-compiling and debugging environment, including an IDE and command-line tools, for building binary images and programs for target boards running the QNX OS 8.0.

  3. Programming

  4. Programmer's Guide

    The QNX OS Programmer's Guide covers a variety of topics that might interest developers who are building applications that will run under the QNX OS.

  5. Understanding the Microkernel's Concept of Time

    Whether you're working with timers or simply getting the time of day, it's important that you understand how the OS works with time.

  6. Short delays

  • QNX Momentics IDE User's Guide

    This User's Guide describes version 8.0 of the Integrated Development Environment (IDE) that's part of the QNX Tool Suite.

  • QNX Software Development Platform

    QNX SDP is a cross-compiling and debugging environment, including an IDE and command-line tools, for building binary images and programs for target boards running the QNX OS 8.0.

    • Quickstart Guide

    • System Architecture

      The System Architecture guide accompanies the QNX OS and is intended for both application developers and end-users.

    • OS Components & Operations

    • Graphics

    • Programming

      • Getting Started with the QNX OS

        Getting Started with the QNX OS: A Guide for Realtime Programmers is intended to introduce you to the QNX OS and help you develop applications and resource managers for it.

      • Programmer's Guide

        The QNX OS Programmer's Guide covers a variety of topics that might interest developers who are building applications that will run under the QNX OS.

        • Compiling and Debugging

          Let's start by looking at some things you should consider when you start to write a program for the QNX OS.

        • QNX OS Architecture and Concepts

          The QNX OS architecture consists of the microkernel and several cooperating processes. These processes communicate with each other via various forms of interprocess communication (IPC). Message passing is the primary form of IPC in QNX OS.

        • Processes

          Your applications should be written in a way that reflects the architecture of the QNX OS—as a set of cooperating processes. In this chapter, we see how to start processes (also known as creating processes) from code, how to terminate them, and how to detect their termination.

        • Multicore Processing

          Multiprocessing systems, whether discrete or multicore, can greatly improve your applications' performance.

        • Working with Access Control Lists (ACLs)

          Some filesystems, such as the Power-Safe (fs-qnx6.so) and QNX compressed filesystems, extend file permissions with Access Control Lists, which are based on the withdrawn IEEE POSIX 1003.1e and 1003.2c draft standards.

        • Understanding the Microkernel's Concept of Time

          Whether you're working with timers or simply getting the time of day, it's important that you understand how the OS works with time.

          • Short delays

          • Oversleeping: errors in delays

            The tick size becomes important almost every time you ask the kernel to do something related to pausing or delaying your process.

          • What time is it?

            The QNX OS maintains two clocks in the system: one is a monotonic count of time since the kernel was initialized (CLOCK_MONOTONIC), and the other is a wall-clock time since January 1st, 1970 (CLOCK_REALTIME).

          • High-resolution timers

            You can use timer tolerance to request a high-resolution timer.

          • Monitoring execution times

            QNX OS includes some special CPU-time clocks that you can use to monitor the execution times for processes and threads.

        • Handling Hardware Interrupts

          This chapter explains the QNX OS mechanisms for quickly reacting to hardware events.

        • Working with Memory

          (or The Persistence of Memory, with a nod to Salvador Dali) In the Process Manager chapter of the System Architecture guide, we looked at how the OS manages memory. This chapter describes how you can work with memory.

        • Freedom from Hardware and Platform Dependencies

          The QNX OS can run on many different hardware platforms. The way in which applications can access peripheral devices and how data is stored varies between platforms. This chapter explains our solutions for minimizing the impact of such platform dependencies.

        • Conventions for Recursive Makefiles and Directories

          In this chapter, we'll look at the supplementary files used in the QNX OS development environment. Although we use the standard make command to create libraries and executables, we also use some of our own conventions in the Makefile syntax.

        • Glossary
      • Writing a Resource Manager
    • System Security Guide

      The QNX System Security Guide is intended for both system integrators who are responsible for the security of a QNX OS system and developers who want to create a QNX OS resource manager free from vulnerabilities.

    • Utilities & Libraries

    • Migrating to QNX OS 8.0
  • QNX Software in the Cloud

    QNX Software in the Cloud enables developers to use the QNX OS in the Amazon cloud environment.

  • QNX Toolkit for Visual Studio Code

    This User's Guide describes the QNX® Toolkit for Visual Studio Code. The guide introduces you to the QNX Toolkit by explaining the QNX development environment and how to build, run, and debug your QNX® Operating System (OS) applications and systems.

  • QNX Hypervisor User's Guide

    This User's Guide explains the QNX hypervisor architecture and provides instructions for installing and running a QNX Hypervisor system, changing system components and configuration, and using hypervisor features such as virtual devices (vdevs).

  • Typographical Conventions, Support, and Licensing

    This section describes the typographical conventions used throughout the documentation, explains how to obtain technical support, and provides some information about licensing.

Short delays

QNX SDP8.0Programmer's GuideDeveloper

If you need a pause, use delay() or the POSIX clock_nanosleep().

If you need a very short delay (e.g., for accessing hardware), you should look at the nanospin*() functions:

  • nanospin()
  • nanospin_count()
  • nanospin_ns()
  • nanospin_ns_to_count()

These functions essentially do a busy-wait loop based on the value returned by ClockCycles().

Page updated: March 05, 2025
Related information
  • Clock and timer services (System Architecture)
  • asctime()
  • ChannelCreate()
  • ClockAdjust()
  • ClockCycles()
  • clock_getcpuclockid()
  • clock_getres()
  • clock_gettime()
  • ClockId()
  • clock_nanosleep()
  • ClockPeriod()
  • clock_settime()
  • ClockTime()
  • ctime()
  • delay()
  • mktime()
  • MsgReceive()
  • nanospin()
  • pthread_getcpuclockid()
  • pthread_mutex_timedlock()
  • struct sigevent
  • sigwait()
  • sleep()
  • strftime()
  • time()
  • timer_create()
  • timer_settime()
  • TimerTimeout()