Time format choice built-in vs. each watchface?

There are many smart people here so maybe someone can explain the decision that the time format is the responsibility of the watchface developers.

Was it a necessity?

Is it such a core function that changing it would be a complete rewrite of the code?

I don’t have a lot of experience with the coding. Years ago I hacked a watchface that was abandoned, but I don’t recall what I did or how I did it. So please try not to get too technical. :slight_smile:

I was just thinking ut seems logical to make it a PebbleOS setting to switch format between 12hr or 24hr.

2 Likes

I agree, if I have a personal preference then that should be stored in the Pebble app and then transfered to any watchface or app.

1 Like

I can’t speak for any other watchface app devs, but in my app a minute change triggers a function to redraw the graphics that are displayed on the screen. the first step in that function is to get the current time. From there I color some pixels accordingly based on how I want to display the time.

If there were a global setting for 12/24 hour preference, then my ‘draw graphics’ function will get the time. From there I color some pixels accordingly based on how I want to display the time.

In both scenarios, it is still up to the dev to decide which format to use.
Adding the setting is certainly no guarantee that it will be used.

2 Likes

I don’t really understand the questions and speculations in this thread. There IS a global watch setting for 12/24 hour. See Build Your Own Watchface in C // Pebble Developers clock_is_24h_style() in the SDK.

Additional sample code pebble_watchface_framework/src/c/watchface.c at 80ab1b50c289bb0fa797e977567e632f19ede99c · clach04/pebble_watchface_framework · GitHub

3 Likes

I am merely saying as a user it feels like it would be beneficial to have the ability to switch between 12hr and 24hr at the system level. Sometimes there’s a watchface that I’d like to use but it doesn’t allow me to choose the time format that I prefer.

I did notice the new app has a toggle, but as it was shared above it is the developer’s choice to implement the function.

2 Likes

While it is still the devs choice, it is easy for choice to use the time setting to be ‘normalized’. I had no clue the setting existed until last night, because the setting was never mentioned in any of the developer docs or examples that I saw.

to make the usage of the feature more prevalent, the feature should be added to the tutorials. If the pebble commandline tool every get the ability to define a new project as a ‘watchface’, then the feature should be added to the boilerplate output.

But those are not my choices to make, I’m just a hobby hacker.

3 Likes

The 12/24 format is automatically handled by the clock_copy_time_string function. If a developer isn’t using that and isn’t using clock_is_24h_style then they are the ones being nonstandard. The very first tutorial on the developer docs also covers this.

2 Likes

I started my watchface dev using the Rocky docs. The current Alloy tutorial appears to be for a watchface that is 24 hour only.

2 Likes

Ah. I didn’t realise you were using Alloy.

2 Likes

I’m not. Once I learned that my sweet Rocky watchface couldn’t be installed on my device, I checked if Alloy was available for my device in the hopes that I could port my js watchface with minimum effort. Alloy is not available either. At that point I went directly to the docs for drawing graphics using c, and ported my logic from js to c.

2 Likes

Right so then my point still stands…? The very first C tutorial tells yuo how to handle 12/24 hour time formatting.

1 Like

Not everyone is going to be using the C tutorial. Reading left to right, top to bottom, the first tutorial a new dev encounters at Tutorials // Pebble Developers is the Alloy tutorial. I’m using C because I have no other option. I started writing my watchface in JS due to having far more experience is JS than in C. I can’t be the only one.

2 Likes

Ah, I see. Yeah I wouldn’t expect the Alloy docs to be very complete at this point :person_shrugging: FWIW the old Rocky tutorial that Core Devices removed from their site used the phone’s locale so it’d match whatever the phone used. You’re right that the Alloy example doesn’t handle that at all.

2 Likes

it probably doesn’t help that my watchface is both a 12 and 24 hour analog display :slight_smile:

2 Likes