Commit f3af0d6f09bf7e392c70814bdb73472af5f1d675
1 parent
dbf49ded
remove and replace zero_pad_2 function by zero_pad_n function located in system/…
…string.anubis function.
Showing
1 changed file
with
5 additions
and
22 deletions
Show diff stats
calexium_lib/web/CXM_multihost_http_server.anubis
| @@ -883,23 +883,6 @@ define Result(Error,String) | @@ -883,23 +883,6 @@ define Result(Error,String) | ||
| 883 | 883 | ||
| 884 | 884 | ||
| 885 | 885 | ||
| 886 | - *** [2.6] Padding integers with zeros. | ||
| 887 | - | ||
| 888 | - 'zero_pad_2' transforms an integer (which is assumed to be between 0 and 99) into a | ||
| 889 | - string with exactly two digits. This is used for formating days, hours, minutes and | ||
| 890 | - seconds. | ||
| 891 | - | ||
| 892 | -define String | ||
| 893 | - zero_pad_2 | ||
| 894 | - ( | ||
| 895 | - Int32 n | ||
| 896 | - ) = | ||
| 897 | - with s = integer_to_string(n), | ||
| 898 | - if length(s) < 2 | ||
| 899 | - then "0"+s | ||
| 900 | - else s. | ||
| 901 | - | ||
| 902 | - | ||
| 903 | 886 | ||
| 904 | 887 | ||
| 905 | 888 | ||
| @@ -987,9 +970,9 @@ define String | @@ -987,9 +970,9 @@ define String | ||
| 987 | = | 970 | = |
| 988 | if convert_time(now) is date_and_time(y,m,d,h,_,_,_,_,_) then | 971 | if convert_time(now) is date_and_time(y,m,d,h,_,_,_,_,_) then |
| 989 | integer_to_string(y)+"_"+ | 972 | integer_to_string(y)+"_"+ |
| 990 | - zero_pad_2(m)+"_"+ | ||
| 991 | - zero_pad_2(d)+"_"+ | ||
| 992 | - zero_pad_2(h). | 973 | + zero_pad_n(2,m)+"_"+ |
| 974 | + zero_pad_n(2,d)+"_"+ | ||
| 975 | + zero_pad_n(2,h). | ||
| 993 | 976 | ||
| 994 | 977 | ||
| 995 | 978 | ||
| @@ -1094,8 +1077,8 @@ define String | @@ -1094,8 +1077,8 @@ define String | ||
| 1094 | ) = | 1077 | ) = |
| 1095 | with dt = convert_time(now), | 1078 | with dt = convert_time(now), |
| 1096 | if remote_IP_address_and_port(client_connection) is (addr,port) then | 1079 | if remote_IP_address_and_port(client_connection) is (addr,port) then |
| 1097 | - integer_to_string(year(dt))+"/"+format_month(month(dt))+"/"+zero_pad_2(day(dt))+" "+ | ||
| 1098 | - zero_pad_2(hour(dt))+":"+zero_pad_2(minute(dt))+":"+zero_pad_2(second(dt))+ | 1080 | + integer_to_string(year(dt))+"/"+format_month(month(dt))+"/"+zero_pad_n(2,day(dt))+" "+ |
| 1081 | + zero_pad_n(2,hour(dt))+":"+zero_pad_n(2,minute(dt))+":"+zero_pad_n(2,second(dt))+ | ||
| 1099 | " from "+ip_addr_to_string(addr)+ | 1082 | " from "+ip_addr_to_string(addr)+ |
| 1100 | ": "+uri(request_line)+"\n"+ | 1083 | ": "+uri(request_line)+"\n"+ |
| 1101 | show_format(desc,headers)+ | 1084 | show_format(desc,headers)+ |