TimeDate
 
Component TimeDate
Time and date
Component Level: High
Methods:
(Methods are user-callable functions/subroutines intended for the component functions control. Please see the Embedded Components page for more information.)
  • Enable - This method enables the component - it starts the time/date timer. Events may be generated.

      ANSIC prototype: byte Enable(void)
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode

  • Disable - This method disables the component - it stops the time/date timer. No events will be generated.

      ANSIC prototype: byte Disable(void)
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode

  • SetTime - This method sets a new actual time.

      ANSIC prototype: byte SetTime(byte Hour, byte Min, byte Sec, byte Sec100)
    • Hour:byte - Hours (0 - 23)
    • Min:byte - Minutes (0 - 59)
    • Sec:byte - Seconds (0 - 59)
    • Sec100:byte - Hundredths of seconds (0 - 99)
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode
      ERR_RANGE - Parameter out of range

  • GetTime - This method returns current time.

      ANSIC prototype: byte GetTime(TIMEREC *Time)
    • Time: Pointer to TIMEREC - Pointer to the structure TIMEREC. It contains actual number of hours, minutes, seconds and hundreths of seconds.
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode

  • SetDate - This method sets a new actual date. See limitations at the page General Info.

      ANSIC prototype: byte SetDate(word Year, byte Month, byte Day)
    • Year:word - Years (16-bit unsigned integer)
    • Month:byte - Months (8-bit unsigned integer)
    • Day:byte - Days (8-bit unsigned integer)
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode
      ERR_RANGE - Parameter out of range

  • GetDate - This method returns current date.

      ANSIC prototype: byte GetDate(DATEREC *Date)
    • Date: Pointer to DATEREC - Pointer to the structure DATEREC. It contains actual year, month, and day description.
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode

  • GetDay - This method returns current day of the week.

      ANSIC prototype: byte GetDay(byte *Day)
    • Day: Pointer to byte - Pointer to returned day - 8-bit unsigned number (Range 0..6, where 0 =Sunday, 1 =Monday, 2 =Tuesday, ...).
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode

  • SetAlarm - This method sets a new time of alarm. (only time, not date - alarm event OnAlarm is called every 24 hours). Setting any parameter out of its range disables alarm.

      ANSIC prototype: byte SetAlarm(byte Hour, byte Min, byte Sec, byte Sec100)
    • Hour:byte - Hours (0 - 23)
    • Min:byte - Minutes (0 - 59)
    • Sec:byte - Seconds (0 - 59)
    • Sec100:byte - Hundreths of seconds (0 - 99)
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode


Note: Some methods can be implemented as macros.