libnjb 2.2.7

Functions | Variables
njbtime.c File Reference
`#include <stdlib.h>`
`#include <string.h>`
`#include "libnjb.h"`
`#include "njbtime.h"`
`#include "njb_error.h"`
`#include "defs.h"`
`#include "base.h"`
`#include "byteorder.h"`

## Functions
njb_time_t * | time_unpack (void *data)
njb_time_t * | time_unpack3 (void *data)
void * | time_pack (njb_time_t *time)
void * | time_pack3 (njb_time_t *time)

## Variables
int | __sub_depth

## Detailed Description

This file deals with the time structures used by the internal clock of the devices.

## Function Documentation

## ◆ time_pack()

void* time_pack | ( | njb_time_t * | time | ) |

Packs a libnjb time structure to the raw format used by the NJB1

Parameters

  time | the libnjb time structure to pack

Returns
  a pointer to raw bytes representing the NJB1 time structure in a newly allocated byte array. The caller shall free this memory after use.

References njb_time_struct::day, from_16bit_to_njb1_bytes(), njb_time_struct::hours, njb_time_struct::minutes, njb_time_struct::month, njb_time_struct::seconds, njb_time_struct::weekday, and njb_time_struct::year.

## ◆ time_pack3()

void* time_pack3 | ( | njb_time_t * | time | ) |

Packs a libnjb time structure to the raw format used by the series 3 devices.

Parameters

  time | the libnjb time structure to pack

Returns
  a pointer to raw bytes representing the series 3 time structure in a newly allocated byte array. The caller shall free this memory after use.

References njb_time_struct::day, njb_time_struct::hours, njb_time_struct::minutes, njb_time_struct::month, njb_time_struct::seconds, njb_time_struct::weekday, and njb_time_struct::year.

## ◆ time_unpack()

njb_time_t* time_unpack | ( | void * | data | ) |

Unpacks a raw NJB1 time structure into libnjb representation.

Parameters

  data | raw memory representing a NJB1 timestamp

Returns
  a libnjb time structure

References njb_time_struct::day, njb_time_struct::hours, njb_time_struct::minutes, njb_time_struct::month, njb1_bytes_to_16bit(), njb_time_struct::seconds, njb_time_struct::weekday, and njb_time_struct::year.

## ◆ time_unpack3()

njb_time_t* time_unpack3 | ( | void * | data | ) |

Unpacks a raw series 3 time structure into libnjb representation.

Parameters

  data | raw memory representing a series 3 timestamp

Returns
  a libnjb time structure

References njb_time_struct::day, njb_time_struct::hours, njb_time_struct::minutes, njb_time_struct::month, njb_time_struct::seconds, njb_time_struct::weekday, and njb_time_struct::year.

## Variable Documentation

## ◆ __sub_depth

int __sub_depth

The current subroutine depth for all of libnjb (global)