# @foxglove/rostime

> ROS Time and Duration primitives and helper methods

Latest version **1.1.3** (published 2026-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @foxglove/rostime
pnpm add @foxglove/rostime
yarn add @foxglove/rostime
bun add @foxglove/rostime
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2026-04-15 |
| First published | 2021-06-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 14 |
| Dependencies | 0 |
| Unpacked size | 133.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 30 |
| Author | Foxglove Technologies Inc |
| Maintainers | foxglovebot, amacneil |
| Keywords | rostime, ros, ros2, robot, operating, system, time, date, duration |

## Links

- npm: https://www.npmjs.com/package/@foxglove/rostime
- Repository: https://github.com/foxglove/ros-typescript
- npm.io page: https://npm.io/package/@foxglove/rostime

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.1.3 (latest) — 2026-04-15
- 1.1.2 — 2022-02-16
- 1.1.1 — 2021-09-29
- 1.1.0 — 2021-06-29

## README

# @foxglove/rostime

> _ROS (Robot Operating System) Time and Duration primitives and helper methods_

[![npm version](https://img.shields.io/npm/v/@foxglove/rostime.svg?style=flat)](https://www.npmjs.com/package/@foxglove/rostime)

## Introduction

[ROS](https://www.ros.org/) (Robot Operating System) defines two primitive types for dealing with time, `ros::Time` and `ros::Duration` (see http://wiki.ros.org/roscpp/Overview/Time). These are both represented by the same data type, `{ sec: number; nsec: number }` and serialized as a pair of 32-bit integers (seconds, then nanoseconds). This package provides a TypeScript type definition for these types and helper methods for working with ROS time and duration values.

## Usage

```Typescript
import * as rostime from "@foxglove/rostime";

const a = { sec: 1, nsec: 0 };
const b = rostime.fixTime({ sec: 0, nsec: 1e9 });
console.log(`${rostime.toString(a)} == ${rostime.toString(b)} (${rostime.areEqual(a, b)})`);
```

## License

@foxglove/rostime is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest

## Stay in touch

Join our [Discord community](https://foxglove.dev/chat) to ask questions, share feedback, and stay up to date on what our team is working on.

---
_Source: https://npm.io/package/@foxglove/rostime · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
