]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10058: [mod_voicemail] voicemail timestamp plays in military time
authorMike Jerris <mike@jerris.com>
Tue, 21 Feb 2017 17:22:38 +0000 (11:22 -0600)
committerMike Jerris <mike@jerris.com>
Tue, 21 Feb 2017 17:22:38 +0000 (11:22 -0600)
src/mod/say/mod_say_en/mod_say_en.c

index c379594feccaf3ad4d8cde78d1ccddbc2211f044..426de61752c8f23485264c238ae9d44a34ed8099 100644 (file)
@@ -381,7 +381,7 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw
        }
 
        if (say_time) {
-               int32_t hour = tm.tm_hour, pm = 0, mil = 0;
+               int32_t hour = tm.tm_hour, mil = 0;
 
                if (say_args->method == SSM_ITERATED) {
                        mil = 1;
@@ -391,28 +391,12 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw
                        switch_say_file(sh, "time/at");
                }
 
-               if (hour > 12) {
-                       if ( mil ) {
-                               mil++;
-                       } else {
-                               hour -= 12;
-                               pm = 1;
-                       }
-               } else if (hour == 12) {
-                       pm = 1;
-               } else if (hour == 0) {
-                       if (mil) {
-                               if (tm.tm_min == 0) {
-                                       hour = 24;
-                               }
-                       } else {
-                               hour = 12;
-                               pm = 0;
-                       }
-               }
-
                if (mil) {
 
+                       if (hour == 0 && tm.tm_min == 0) {
+                               hour = 24;
+                       }
+
                        if (hour < 10) {
                                say_num(sh, 0, SSM_PRONOUNCED);
                        }
@@ -431,6 +415,18 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw
                        switch_say_file(sh, "time/hours");
 
                } else {
+                       switch_bool_t pm = 0;
+
+                       if (hour >= 12) {
+                               pm = 1;
+                       }
+
+                       if (hour > 12) {
+                               hour -= 12;
+                       } else if (hour == 0) {
+                               hour = 12;
+                       }
+
                        say_num(sh, hour, SSM_PRONOUNCED);
                        
                        if (tm.tm_min > 9) {