Skip to content

Make NVDA accurate to the second when reporting time#14792

Merged
seanbudd merged 11 commits into
nvaccess:masterfrom
cary-rowen:ReportTimeAccurateToSecond
Jun 1, 2023
Merged

Make NVDA accurate to the second when reporting time#14792
seanbudd merged 11 commits into
nvaccess:masterfrom
cary-rowen:ReportTimeAccurateToSecond

Conversation

@cary-rowen

@cary-rowen cary-rowen commented Apr 5, 2023

Copy link
Copy Markdown
Contributor

Link to issue number:

Close #14742

Summary of the issue:

Currently, NVDA+F12 does not include seconds when reporting time.
In some online shopping malls merchants often have limited-time promotions, For example, "3 minutes and 59 seconds left" to start flash sale.
It might help if the visually impaired could get the seconds of the current time in a more accurate way.

Description of user facing changes

NVDA does not control the format of the reported time, it is determined by the user's system settings, specifically, NVDA will refer to the 'Long time' option in the system settings.

In the latest Windows 11 operating system, Microsoft allows users to choose whether to display seconds on the system clock.
For Windows 10 and older operating systems, users can choose whether to display seconds on the system clock by changing the registry.
If the user has allowed seconds to be displayed on the system clock, then NVDA +F12 will also include the seconds.

The following takes English (United States) language as an example to list the possible options and the behavior of NVDA +F12 under the corresponding options (what NVDA will say):

Long time formats New behavior of NVDA Old behavior of NVDA
hh:mm:ss tt 09:21:11 AM 09:21 AM
h:mm:ss tt 9:21:11 AM 9:21 AM
H:mm:ss 9:21:11 9:21
HH:mm:ss 09:21:11 09:21

Description of development approach

The current internal implementation of NVDA+F12 uses winKernel.GetTimeFormatEx.
text=winKernel.GetTimeFormatEx(winKernel.LOCALE_NAME_USER_DEFAULT, winKernel.TIME_NOSECONDS, None, None)
If we want to implement this feature, just set the second parameter in the above function to None.
However, we need to implement a function to query the registry for settings to keep NVDA behaving in the same way as the system settings.
For this I implemented "isSystemClockSecondsVisible" in systemUtils.py.

Testing strategy:

manual testing

Known issues with pull request:

None

Change log entries:

New features
Now, NVDA+F12 includes seconds when reporting time.
Changes
Bug fixes
For Developers

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • Security precautions taken.

@cary-rowen cary-rowen requested a review from a team as a code owner April 5, 2023 14:02
@cary-rowen cary-rowen requested a review from seanbudd April 5, 2023 14:02
@cary-rowen

Copy link
Copy Markdown
Contributor Author

I read the user guide section about NVDA +F12, do we need to emphasize in the user guide that the reported time will be accurate to the second?

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit e99c455dbf

@seanbudd

seanbudd commented Apr 6, 2023

Copy link
Copy Markdown
Member

I read the user guide section about NVDA +F12, do we need to emphasize in the user guide that the reported time will be accurate to the second?

I think this is unnecessary. As long as nothing specifically suggests that the time will be reported in hours and minutes only.

Comment thread source/globalCommands.py Outdated
@michaelDCurran

Copy link
Copy Markdown
Member

I understand NVDA currently has no control over this, but I'm pretty sure the more common long time format in Windows is 9:40:20 am, not 9:40 am and 20 seconds. In fact, in English Australian at least, I don't even have the latter option at all.
I appreciate that having seconds is very beneficial, and I myself have the ability to get used to it. But I just want it acknowledged that this pr is changing the most known, and probably the most used script in NVDA, and therefore will be noticed by everyone.
As much as we want to avoid extra settings, perhaps this is a case where the user needs control, with the default being what we always had.
Though I'm happy to see community opinion on this one.

@cary-rowen

Copy link
Copy Markdown
Contributor Author

I understand NVDA currently has no control over this, but I'm pretty sure the more common long time format in Windows is 9:40:20 am, not 9:40 am and 20 seconds. In fact, in English Australian at least, I don't even have the latter option at all.
Yes, you are right, I set the system language to English (United States) The time format reported by nvda is: 9:24:29 AM.

I'll change the description in the PR so more people can understand the change.
As for whether there really needs to be an option to control the default behavior, I think that might be redundant, but I'd like to hear from the community as well.

@seanbudd seanbudd added the blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. label Apr 6, 2023
@cary-rowen

Copy link
Copy Markdown
Contributor Author

I updated the 'Description of user facing changes' section in the original description, it should be clearer now and it's easier for community users to know about the change.

@codeofdusk

Copy link
Copy Markdown
Contributor

I definitely would prefer "9:40 AM and 20 seconds" (or "09:40 and 20 seconds")...

@LeonarddeR

Copy link
Copy Markdown
Collaborator

For me as a user of the 24 hour format, 9:40:20 is ok. I don't think we have to bother about people not liking the change as long as the hour and minute come first.

@CyrilleB79

Copy link
Copy Markdown
Contributor

Onn my French localized system, the default time format are the following (24-hour format):

  • short format: 09:40
  • long format: 09:40:20

Currently, testing with OneCore, eSpeak and IBMTTS, the short format is always reported as "9 heures 40"; in French, "heures" stands for "hours". this is a common way to report time so this is OK. Note that converting colon in "heures" is done at the synth level, it's not an NVDA processing.

The long format "09:40:20" is reported as follows:

  • With eSpeak or IBMTTS: "9 heures 40 20"
  • With OneCore: "9 heures 40 minutes 20 secondes"

OneCore reporting is very clear. eSpeak/IBMTTS is less clear but still understandable with time = 09:40:20.

However eSpeak/IBMTTS reporting is confusing when reporting the following times:

  • "09:00:10" is reported as "9 heures 10" which is commonly understood as "9 hours, 10 minutes" whereas here it is 9 hours and 10 seconds.
  • "09:04:20" is reported as "neuf heures quatre vingt" wich can be understood as "9 hours 4 20" but also "9 hours 80" since in French 80 is called "quatre-vingts", which literally means "four times twenty". Of course, 80 minutes or seconds have no sense. But hearing "quatre vingt", a French would immediately understand 80 and only after a while, may understand that it is actually a four followed by a twenty.

Thus, IMO, reporting "09:04:20" is not an option at all.

We can thus opt for the following two options:

  1. Use system format for "HH:MM" and append a translatable string for seconds with the word "and" preventing confusion between seconds and minutes.
  2. Make translatable the whole string.

I prefer the first solution because:

  • It can take advantage of the format defined by the system at least for hours and minutes
  • The second solution may be hard to implement with the 12-hour format (AM/PM)

The drawback of the first solution, is that it may be impacted when increasing punctuation level. However it was already the case with current time reporting in NVDA.

If we really want to work around this problem with punctuation level, we may add two new complex symbols in the symbol file: "colon separating hours and minutes" and "colon separating minutes and seconds". This could be made in a subsequent PR in case it cause issues and has to be reverted. I am specifically thinking to other situations where colons are used between digits, e.g. in MAC addresses.

@CyrilleB79

Copy link
Copy Markdown
Contributor

First I was thinking to use the following formatted string:
"{systemTimeFormat} and {seconds} seconds"
systemTimeFormat being replaced with "09:40" and seconds with "20".

However, in German maybe we have issue, with: "09:05:30".
If reported as "09:30 und 5 seconds", may it be misunderstood as "09:35" (depending on the TTS)?
Cc @Adriani90, @bdorer

If this issue is confirmed with German, we may:

  • either use "{systemTimeFormat}, and {seconds} seconds" as formatted string, with comma, for all, in order to avoid confusion
  • or use "{systemTimeFormat} and {seconds} seconds" anyway, without the comma, but let German translators add the comma in their translation

@Adriani90

Copy link
Copy Markdown
Collaborator

@CyrilleB79 your example works well with Onecore and Sapi5 synths, but fails with eSpeak. In german eSpeak reports "o'clock" after every : (colon) so like 9 Uhr 5 Uhr 30. For me this is still a good experience. I am not sure if it is even possible to meet all expectations for every language and synth.

@CyrilleB79

Copy link
Copy Markdown
Contributor

Actually I was thinking to use the following string in German "09:05 und 30 Sekunden" (with or without the comma)
Is this a problem?

Note: Strangely eSpeak reports two times "Uhr" in "09:05:30" but only once in "09:40:20". This is not the case in French. So it's probably an issue to report to the German people of eSpeak... a regexp to fix...

@Adriani90

Copy link
Copy Markdown
Collaborator

Yes unfortunately german language does what most other languages do not do. In german, for example 35 is gramatically spoken as (five and thirty) not (thirty five). That means regardless of the synth, even putting a koma might cause confusions since people would hear (nine o'clock zero five, and thirty seconds) could also mean there are thirty five seconds. It has to have the word "minutes" spoken after the 05, then it would work without problems. But eSpeak does not provide the regexp for "minutes" in german.

@XLTechie

XLTechie commented Apr 6, 2023 via email

Copy link
Copy Markdown
Collaborator

@Adriani90

Adriani90 commented Apr 6, 2023 via email

Copy link
Copy Markdown
Collaborator

@CyrilleB79

Copy link
Copy Markdown
Contributor

I think that having already a more precise reporting of the time would be an improvement is the goal of this PR.

But IMO there is no need to be very rigorous with the seconds. I think that the feature should remain simple.

@Adriani90's proposal with many gestures may land in an add-on but is far more complex for the general audience of NVDA. Also, the layered gestures have not found their way in NVDA for 10 years at least. I think that if they become one day a reality in core, there are many features which would require them before the clock.

@XLTechie your remark about accuracy is exact, and id depends on the speech rate. But as explained before, I do not think that we need such accuracy. The only known way to report time accurately at the second speaking is as it was done in the speaking clock or at the radio: "At the fourth beep, it will be exactly 9 hours 40 minutes and 20 seconds......... beep, beep, beep, beeeeeeeep".

@Adriani90

Adriani90 commented Apr 6, 2023 via email

Copy link
Copy Markdown
Collaborator

@cary-rowen

Copy link
Copy Markdown
Contributor Author

@XLTechie

Are the seconds going to be inaccurate before they are even announced?
This phenomenon exists, but I don't think we need to manually intervene (i.e. increase) the number of seconds being reported.
Because we can never assume how slow or fast a user's NVDA speech is.

@cary-rowen

Copy link
Copy Markdown
Contributor Author

Actually Chinese users also prefer the format: "11 Hours 30 Minutes 38 Seconds" instead of 11:30:38 because the latter may depend heavily on the synthesizer.

@amirsol81

Copy link
Copy Markdown

Definitely agree with @CyrilleB79 about not including this in the form of a layered key stroke/feature. While I like this second-reporting feature, I think it should be kept simple - And it need not be super-accurate to be useful - its mere inclusion makes it a useful feature IMO.

@lukaszgo1

Copy link
Copy Markdown
Contributor

While the above discussion about how this change should be implemented is pretty important to have, I'm wondering if enough thought has been given with regard to why we need this at all.
@michaelDCurran you said:

I appreciate that having seconds is very beneficial, ...

In what cases having seconds announced seems beneficial to you?

My understanding is that NVDA+F12 was created since sighted people can very easily glance at the clock in the system tray to know the time, and for blind users navigating there is much more tedious. However by default clock shows only hours and minutes and to have seconds shown there it is necessary to either use an alternate clock (operating systems before Windows 10), make a registry edit (Windows 10) or enable a particular option on Windows 11. This suggests to me that for most use cases seconds are redundant for sighted people, and this should be no different for blind users.
The argument that if seconds come last they can be easily silenced by pressing control or resuming navigation is valid to some extend, however less "unwanted" speech the better.
The use case presented in the PR and issue description of a short promotion where seconds are important does not sound very realistic to me - in most such cases there is a separate counter on a store's web page otherwise user would be forced to do mental arithmetic even if seconds are reported when checking time.

@cary-rowen

cary-rowen commented Apr 9, 2023

Copy link
Copy Markdown
Contributor Author

@lukaszgo1
You wrote:

The use case presented in the PR and issue description of a short promotion where seconds are important does not sound very realistic to me - in most such cases there is a separate counter on a store's web page otherwise user would be forced to do mental arithmetic even if seconds are reported when checking time.

As far as this use case is concerned, the situation I encountered: Yes, the page may contain a counter, and the change of this counter is obvious to non-visually impaired users at a glance.
However, this doesn't seem to be easy to observe at any time for visually impaired users, and in order to observe this, I may have to press the arrow keys frequently to read the latest value of the counter.

@Adriani90

Adriani90 commented Apr 9, 2023 via email

Copy link
Copy Markdown
Collaborator

@CyrilleB79

Copy link
Copy Markdown
Contributor

lukaszgo1 wrote:

However by default clock shows only hours and minutes and to have seconds shown there it is necessary to either use an alternate clock (operating systems before Windows 10), make a registry edit (Windows 10) or enable a particular option on Windows 11.

Maybe we could make seconds spoken according to that situations (tweak, Windows setting). Sure, the feature would be less notified though... I was quite disappointed, time ago, when I applied the tweak and discover then that NVDA ignored it.

I fully support this solution which follows a better integration with Windows and which becomes the norm with Windows 11.

For Windows 7/8 users and the majority of Windows 10 users who do not want to play with the registry, they just can use the clock add-on.

I agree that the change made this way would be less visible. Advertising it via "In process" blog may be a solution to make it more visible. Cc @Qchristensen

@cary-rowen

Copy link
Copy Markdown
Contributor Author

I noticed that everyone's discussion is mainly focused on how the speech synthesizer handles the time format of hh:mm:ss,
This doesn't seem to have much to do with this change, i.e. you might encounter this time format in other places besides NVDA+F12.

@seanbudd

seanbudd commented May 3, 2023

Copy link
Copy Markdown
Member

Can you please implement the method outlined in this discussion, using the Windows registry/settings to decide whether to speak seconds.

However by default clock shows only hours and minutes and to have seconds shown there it is necessary to either use an alternate clock (operating systems before Windows 10), make a registry edit (Windows 10) or enable a particular option on Windows 11.

Maybe we could make seconds spoken according to that situations (tweak, Windows setting). Sure, the feature would be less notified though... I was quite disappointed, time ago, when I applied the tweak and discover then that NVDA ignored it.

I fully support this solution which follows a better integration with Windows and which becomes the norm with Windows 11.

@seanbudd seanbudd removed the blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. label May 3, 2023
@seanbudd seanbudd marked this pull request as draft May 3, 2023 23:51
@cary-rowen

Copy link
Copy Markdown
Contributor Author

Hi @seanbudd
OK, let me clarify:

  1. The next thing to do is to read the value in the registry so that NVDA follows the Windows settings.
  2. We don't interfere with how NVDA reports the default format of hh:mm:ss, as mentioned before: this time format is very common, not just encountered in NVDA+F12. If it's a problem, maybe it should be dealt with separately.

Thanks

@seanbudd

seanbudd commented May 4, 2023

Copy link
Copy Markdown
Member

Yes, that plan sounds good.

@XLTechie

XLTechie commented May 4, 2023 via email

Copy link
Copy Markdown
Collaborator

@seanbudd

seanbudd commented May 4, 2023

Copy link
Copy Markdown
Member

The issue is that the process for Windows may vary based on the version of Windows. Tracking Windows documentation in NVDA is really out of our scope. I would rather we introduce an NVDA setting in our settings panel to toggle the registry setting, and document that.

@Qchristensen

Copy link
Copy Markdown
Member

I agree with Sean - I think it would be worth a mention in the user guide. The user guide currently includes NVDA+F12 in the table reporting system information (4.7) where it has the description:

"Pressing once reports the current time, pressing twice reports the date"

I think it would be worth adding something like "The time and date are reported in the format specified in Windows time and date settings". I don't think we need to specify how to get to those time and date settings in Windows.

@cary-rowen cary-rowen marked this pull request as ready for review May 17, 2023 18:24
@cary-rowen cary-rowen requested a review from seanbudd May 18, 2023 00:57
@amirmahdifard

Copy link
Copy Markdown

i also think that this should be added like this and we don't need an option for this, people can just press controle to not hear the second, i like to hear the second.

Comment thread source/globalCommands.py Outdated
Comment thread source/globalCommands.py Outdated
…rt of systemUtils in globalCommands.py to the top of the file.
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit cf580cb9ac

@cary-rowen cary-rowen requested a review from a team as a code owner May 31, 2023 09:02
@cary-rowen cary-rowen requested a review from Qchristensen May 31, 2023 09:02
Comment thread user_docs/en/userGuide.t2t Outdated

@Qchristensen Qchristensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, well done.

@seanbudd seanbudd merged commit 8edfbbf into nvaccess:master Jun 1, 2023
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accurate to the second when using NVDA+f12 to get the time.