pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • Examples
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

Pebble C API

  • Pebble C API
  • Pebble JavaScript API
  • PebbleKit JS
  • PebbleKit iOS
  • PebbleKit Android
  • Foundation
    • App
    • App Communication
    • App Glance
    • AppMessage
    • AppSync
    • AppWorker
    • DataLogging
    • DataStructures
      • UUID
    • Dictation
    • Dictionary
    • Event Service
      • AccelerometerService
      • AppFocusService
      • BatteryStateService
      • CompassService
      • ConnectionService
      • HealthService
      • TickTimerService
    • Exit Reason
    • Internationalization
    • Launch Reason
    • Logging
    • Math
    • Memory Management
    • Platform
    • Resources
      • File Formats
    • Storage
    • Timer
    • Wakeup
    • Wall Time
    • WatchInfo
    • Rocky
  • Graphics
    • Draw Commands
    • Drawing Paths
    • Drawing Primitives
    • Drawing Text
    • Fonts
    • Graphics Context
    • Graphics Types
      • Color Definitions
  • User Interface
    • Animation
      • PropertyAnimation
    • Clicks
    • Layers
      • ActionBarLayer
      • BitmapLayer
      • MenuLayer
      • RotBitmapLayer
      • ScrollLayer
      • SimpleMenuLayer
      • StatusBarLayer
      • TextLayer
    • Light
    • Preferences
    • UnobstructedArea
    • Vibes
    • Window
      • ActionMenu
      • NumberWindow
    • Window Stack
  • Standard C
    • Format
    • Locale
    • Math
    • Memory
    • String
    • Time

TickTimerService

Handling time components.

The TickTimerService allows your app to be called every time one Time component has changed. This is extremely important for watchfaces. Your app can choose on which time component change a tick should occur. Time components are defined by a TimeUnits enum bitmask.

Function Documentation

void tick_timer_service_subscribe(TimeUnits tick_units, TickHandler handler)

Subscribe to the tick timer event service. Once subscribed, the handler gets called on every requested unit change. Calling this function multiple times will override the units and handler (i.e., only  the last tick_units and handler passed will be used).

Parameters

handler

The callback to be executed on tick events

tick_units

a bitmask of all the units that have changed

void tick_timer_service_unsubscribe(void)

Unsubscribe from the tick timer event service. Once unsubscribed, the previously registered handler will no longer be called.

Enum Documentation

enum TimeUnits

Time unit flags that can be used to create a bitmask for use in tick_timer_service_subscribe(). This will also be passed to TickHandler.

Enumerators

SECOND_UNIT

Flag to represent the "seconds" time unit.

MINUTE_UNIT

Flag to represent the "minutes" time unit.

HOUR_UNIT

Flag to represent the "hours" time unit.

DAY_UNIT

Flag to represent the "days" time unit.

MONTH_UNIT

Flag to represent the "months" time unit.

YEAR_UNIT

Flag to represent the "years" time unit.

Typedef Documentation

typedef void(* TickHandler)(struct tm *tick_time, TimeUnits units_changed)

Callback type for tick timer events.

Parameters

tick_time

the time at which the tick event was triggered

units_changed

which unit change triggered this tick event

Need some help?

Functions

  • tick_timer_service_subscribe
  • tick_timer_service_unsubscribe

Enums

  • TimeUnits

Typedefs

  • TickHandler

Getting Help

Do you have questions about the Pebble SDK?

Do you need some help understanding something on this page?

You can either take advantage of our awesome developer community and check out the SDK Help forums, or you can send us a message through the website!