Socket
Book a DemoInstallSign in
Socket

bcd-date

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcd-date

Decodes a BCD datetime buffer into a normal javascript date object

2.1.3
latest
Source
npmnpm
Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

bcd-date

Build Status

Node.js package to decode BCD datetime buffers used by Siemens and Rockwell PLCs into a normal javascript date objects.

The format of the BCD date is as follows

ByteContentsRange
0Year90-89
1Month1-12
2Day1-31
3Hour0-23
4Minute0-59
5Second0-59
62 MSD of ms0-99
7 (1st nibble)LSD of ms0-9
7 (2nd nibble)Day of week (unused)1-7

example

var bcdDate = require('bcd-date');

var buffer = new Buffer('1012231130301235', 'hex');

var date   = bcdDate.decode(buffer);
var buffer = bcdDate.encode(date);

// date   == date at 2010-12-23 11:30:30.123
// buffer == buffer of 1012231130301235

// decode as UTC
var date = bcdDate.decode(buffer, true);

// encode as UTC
var date = bcdDate.encode(buffer, true);

Keywords

bcd

FAQs

Package last updated on 13 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.