Skip to content
Version 6.1.0
Contact Us

BACnetStack_SetTrendLogStartStopTime

bool BACnetStack_SetTrendLogStartStopTime(
const uint32_t deviceInstance,
const uint16_t objectType,
const uint32_t objectInstance,
const uint8_t startHour,
const uint8_t startMinute,
const uint8_t startSecond,
const uint8_t startHundredthSecond,
const uint8_t startYearMinus1900,
const uint8_t startMonth,
const uint8_t startDay,
const uint8_t startWeekday,
const uint8_t stopHour,
const uint8_t stopMinute,
const uint8_t stopSecond,
const uint8_t stopHundredthSecond,
const uint8_t stopYearMinus1900,
const uint8_t stopMonth,
const uint8_t stopDay,
const uint8_t stopWeekday);

Sets the Start and Stop time properties of a Trend Log or Trend Log Multiple object.

This function should only be called after the AddTrendLogObject or AddTrendLogMultipleObject functions.

WHICH CLOCK: logging runs while Start_Time is unspecified or before “now” and Stop_Time is unspecified or after “now” (both strict). A bound counts as unspecified - it is ignored entirely - if ANY of its year, month, day, hour, minute, second or hundredths is 255, or its date is a pattern (month 13/14, day 32-34); only the weekday may be 255 in a concrete bound. The stack’s “now” is the CallbackGetSystemTime value (seconds since the Unix epoch, i.e. UTC) converted with gmtime and shifted by the Device object’s UTC_Offset as read through CallbackGetPropertySignedInteger (0 when the host does not serve UTC_Offset). Build the two values from that same clock - with UTC_Offset unserved, gmtime(time(NULL)), NOT localtime(). A window built from local time never brackets the stack’s “now” on a host outside UTC, and the log silently records nothing.

BACnet reference: ANSI/ASHRAE 135-2024 clause 12.25 (Trend Log Object Type).

Parameter Direction Description
deviceInstance in The instance of the device that contains the Trend Log object.
objectType in The type of trend log object. Must be either BACnetObjectType::trendLog or BACnetObjectType::trendLogMultiple. With objectInstance, this is one BACnet Object Identifier carried as two parameters (see the API conventions).
objectInstance in The instance of the Trend Log object to update.
startHour in The hour for the start time. startHour through startWeekday together form Start_Time, a BACnetDateTime (cl. 12.25, 12.30, cl. 21); the stop parameters form Stop_Time the same way.
startMinute in The minute for the start time.
startSecond in The second for the start time.
startHundredthSecond in The hundredthSecond for the start time.
startYearMinus1900 in The year for the start time. BACnet WIRE year, i.e. the calendar year MINUS 1900 (cl. 20.2.12) - 2026 is 126, not 2026. 255 = unspecified. This is a uint8_t: passing a 4-digit year truncates silently at the call site and produces a valid-looking wrong date.
startMonth in The month for the start time. January = 1 (cl. 20.2.12). 13 = odd months, 14 = even months, 255 = unspecified.
startDay in The day for the start time. 1..31 (cl. 20.2.12). 32 = last day of month, 33 = odd days, 34 = even days, 255 = unspecified.
startWeekday in The weekday for the start time. Monday = 1 .. Sunday = 7 (cl. 20.2.12). 255 = unspecified.
stopHour in The hour for the stop time.
stopMinute in The minute for the stop time.
stopSecond in The second for the stop time.
stopHundredthSecond in The hundredthSecond for the stop time.
stopYearMinus1900 in The year for the stop time. BACnet WIRE year, i.e. the calendar year MINUS 1900 (cl. 20.2.12) - 2026 is 126, not 2026. 255 = unspecified. This is a uint8_t: passing a 4-digit year truncates silently at the call site and produces a valid-looking wrong date.
stopMonth in The month for the stop time. January = 1 (cl. 20.2.12). 13 = odd months, 14 = even months, 255 = unspecified.
stopDay in The day for the stop time. 1..31 (cl. 20.2.12). 32 = last day of month, 33 = odd days, 34 = even days, 255 = unspecified.
stopWeekday in The weekday for the stop time. Monday = 1 .. Sunday = 7 (cl. 20.2.12). 255 = unspecified.

True on success; false if the device or Trend Log object does not exist, or trending support was not compiled.

Topic: Schedules, calendars, trend logs and other object configuration. Declared in CASBACnetStackDLL.h.