Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed 12-hour clock #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"resources": {
"media": [
{
"characterRegex": "[0-9\\.]",
"characterRegex": "[0-9. ]",
"file": "fonts/LCARSGTJ3_58.ttf",
"name": "LCARS_58",
"targetPlatforms": [
Expand Down
18 changes: 12 additions & 6 deletions src/c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static int loweracrossline = 90, upperacrossline = 50, textleft = 25, watchwidth
static PropertyAnimation *image_property_animation; //1800000
static bool WeatherSetupStatusKey = S_FALSE, WeatherSetupStatusProvider = S_FALSE, WeatherReadyRecieved = S_FALSE, HibernateEnable = S_TRUE, SleepEnable = S_TRUE;
GColor text_color;
static EventHandle s_health_event_handle, s_tick_timer_event_handle;//, s_idle_timer_event_handle;
static EventHandle s_health_event_handle=NULL, s_tick_timer_event_handle=NULL;//, s_idle_timer_event_handle;

static void read_persist()
{
Expand Down Expand Up @@ -678,7 +678,7 @@ static void update_time() {
// Write the current hours and minutes into a buffer
static char s_buffer[8];
strftime(s_buffer, sizeof(s_buffer), clock_is_24h_style() ?
"%H%M" : "%I%M", tick_time);
"%H%M" : "%l%M", tick_time);
Current_Min=tick_time->tm_min;
Current_Hour=tick_time->tm_hour;
// Display this time on the TextLayer
Expand Down Expand Up @@ -1023,7 +1023,9 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context)
HibernateEnable = data->value->int32 == 1;

//register to recieve significant updates of which we are looking for sleep updates
events_health_service_events_unsubscribe(s_health_event_handle);
if (s_health_event_handle != NULL) {
events_health_service_events_unsubscribe(s_health_event_handle);
}
if (SleepEnable||HibernateEnable) {
s_health_event_handle = events_health_service_events_subscribe(prv_health_event_handler, NULL);
}
Expand Down Expand Up @@ -1159,8 +1161,12 @@ static void window_unload(Window *window) {
//unsubscribe from services
events_battery_state_service_unsubscribe(battery_callback);
events_connection_service_unsubscribe(bluetooth_callback);
events_tick_timer_service_unsubscribe(tick_handler);
events_health_service_events_unsubscribe(s_health_event_handle);
if (s_tick_timer_event_handle!=NULL) {
events_tick_timer_service_unsubscribe(s_tick_timer_event_handle);
}
if (s_health_event_handle != NULL) {
events_health_service_events_unsubscribe(s_health_event_handle);
}
events_app_message_unsubscribe(inbox_received_callback);
events_app_message_unsubscribe(inbox_dropped_callback);
events_app_message_unsubscribe(outbox_failed_callback);
Expand Down Expand Up @@ -1238,4 +1244,4 @@ int main() {
init();
app_event_loop();
deinit();
}
}