New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@magmacomputing/tempo-plugin-sync

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magmacomputing/tempo-plugin-sync

Tempo community plugin providing lock-free, highly precise cross-thread synchronization via SharedArrayBuffer and Atomics.

Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
161
1912.5%
Maintainers
1
Weekly downloads
 
Created
Source

Tempo Plugin

@magmacomputing/tempo-plugin-sync

npm version npm peer dependency version License TypeScript Ready Documentation

This is a Community plugin for the Tempo library that provides lock-free, nanosecond-accurate cross-thread time synchronization using SharedArrayBuffer and Atomics.

👉 View the full documentation on our GitHub Pages

Perfect for: High-frequency trading platforms, real-time multiplayer game servers, distributed microservice tracing, and extreme-precision scientific telemetry.

Installation

npm install @magmacomputing/tempo-plugin-sync

Usage

import { Tempo } from '@magmacomputing/tempo';
import { SyncPlugin } from '@magmacomputing/tempo-plugin-sync';

Tempo.init({ 
  plugins: [SyncPlugin] 
});

// Master Thread: Start the clock
const clock = Tempo.sync.startClock({ updateIntervalMs: 1 });
const buffer = clock.buffer; // Pass this SharedArrayBuffer to your workers

Reading from Worker Threads

To read the synchronized time from inside a worker thread, pass the SharedArrayBuffer via workerData and instantiate an AtomicReader.

// worker.ts
import { workerData } from 'node:worker_threads';
import { AtomicReader } from '@magmacomputing/tempo-plugin-sync';

// Hydrate the reader using the master buffer
const reader = new AtomicReader(workerData.buffer);

// 1. Get raw milliseconds (O(1) Atomic Read)
const ms = reader.now(); 

// 2. Get high-precision BigInt nanoseconds
const ns = reader.nowNano();

// 3. Hydrate a brand new Tempo instance with exact precision
const t = reader.getTempo();

Licensing

This is a Community plugin. It is completely free and open-source for personal and commercial use. No license token is required.

For commercial licensing options, please contact Magma Computing.

Keywords

tempo

FAQs

Package last updated on 22 Jul 2026

Related posts