Collaboration diagram for Time Routines:
| typedef int64_t switch_interval_time_t |
number of microseconds in the interval
Definition at line 240 of file switch_apr.h.
| typedef int64_t switch_time_t |
number of microseconds since 00:00:00 january 1, 1970 UTC
Definition at line 237 of file switch_apr.h.
| void switch_micro_sleep | ( | switch_interval_time_t | t | ) |
Definition at line 444 of file switch_time.c.
References do_sleep().
00445 { 00446 do_sleep(t); 00447 }
| switch_status_t switch_rfc822_date | ( | char * | date_str, | |
| switch_time_t | t | |||
| ) |
switch_rfc822_date formats dates in the RFC822 format in an efficient manner. It is a fixed length format which requires the indicated amount of storage, including the trailing NUL terminator.
| date_str | String to write to. | |
| t | the time to convert |
Definition at line 355 of file switch_apr.c.
Referenced by switch_event_prep_for_delivery_detailed().
| void switch_sleep | ( | switch_interval_time_t | t | ) |
Sleep for the specified number of micro-seconds.
| t | desired amount of time to sleep. |
Definition at line 449 of file switch_time.c.
References do_sleep(), globals, and switch_cond_yield().
Referenced by main(), and msleep().
00450 { 00451 00452 if (globals.RUNNING != 1 || t < 1000 || t >= 10000) { 00453 do_sleep(t); 00454 return; 00455 } 00456 #ifndef DISABLE_1MS_COND 00457 if (globals.use_cond_yield == 1) { 00458 switch_cond_yield(t); 00459 return; 00460 } 00461 #endif 00462 00463 do_sleep(t); 00464 }
| switch_status_t switch_strftime | ( | char * | s, | |
| switch_size_t * | retsize, | |||
| switch_size_t | max, | |||
| const char * | format, | |||
| switch_time_exp_t * | tm | |||
| ) |
formats the exploded time according to the format specified
| s | string to write to | |
| retsize | The length of the returned string | |
| max | The maximum length of the string | |
| format | The format for the time string | |
| tm | The time to convert |
Definition at line 149 of file switch_apr.c.
References SWITCH_STATUS_FALSE.
Referenced by switch_xml_std_datetime_check().
00150 { 00151 const char *p = format; 00152 00153 if (!p) 00154 return SWITCH_STATUS_FALSE; 00155 00156 while (*p) { 00157 if (*p == '%') { 00158 switch (*(++p)) { 00159 case 'C': 00160 case 'D': 00161 case 'r': 00162 case 'R': 00163 case 'T': 00164 case 'e': 00165 case 'a': 00166 case 'A': 00167 case 'b': 00168 case 'B': 00169 case 'c': 00170 case 'd': 00171 case 'H': 00172 case 'I': 00173 case 'j': 00174 case 'm': 00175 case 'M': 00176 case 'p': 00177 case 'S': 00178 case 'U': 00179 case 'w': 00180 case 'W': 00181 case 'x': 00182 case 'X': 00183 case 'y': 00184 case 'Y': 00185 case 'z': 00186 case 'Z': 00187 case '%': 00188 p++; 00189 continue; 00190 case '\0': 00191 default: 00192 return SWITCH_STATUS_FALSE; 00193 } 00194 } 00195 p++; 00196 } 00197 00198 return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm); 00199 }
| switch_status_t switch_strftime_nocheck | ( | char * | s, | |
| switch_size_t * | retsize, | |||
| switch_size_t | max, | |||
| const char * | format, | |||
| switch_time_exp_t * | tm | |||
| ) |
formats the exploded time according to the format specified (does not validate format string)
| s | string to write to | |
| retsize | The length of the returned string | |
| max | The maximum length of the string | |
| format | The format for the time string | |
| tm | The time to convert |
Definition at line 201 of file switch_apr.c.
Referenced by switch_console_printf(), switch_event_prep_for_delivery_detailed(), and switch_strftime_tz().
| switch_status_t switch_time_exp_get | ( | switch_time_t * | result, | |
| switch_time_exp_t * | input | |||
| ) |
Convert time value from human readable format to a numeric apr_time_t e.g. elapsed usec since epoch
| result | the resulting imploded time | |
| input | the input exploded time |
Definition at line 335 of file switch_apr.c.
| switch_status_t switch_time_exp_gmt | ( | switch_time_exp_t * | result, | |
| switch_time_t | input | |||
| ) |
convert a time to its human readable components in GMT timezone
| result | the exploded time | |
| input | the time to explode |
Definition at line 350 of file switch_apr.c.
| switch_status_t switch_time_exp_gmt_get | ( | switch_time_t * | result, | |
| switch_time_exp_t * | input | |||
| ) |
Convert time value from human readable format to a numeric apr_time_t that always represents GMT
| result | the resulting imploded time | |
| input | the input exploded time |
Definition at line 330 of file switch_apr.c.
Referenced by switch_str_time().
| switch_status_t switch_time_exp_lt | ( | switch_time_exp_t * | result, | |
| switch_time_t | input | |||
| ) |
convert a time to its human readable components in local timezone
| result | the exploded time | |
| input | the time to explode |
Definition at line 340 of file switch_apr.c.
Referenced by switch_console_printf(), switch_event_prep_for_delivery_detailed(), switch_log_vprintf(), switch_str_time(), and switch_xml_std_datetime_check().
| switch_status_t switch_time_exp_tz | ( | switch_time_exp_t * | result, | |
| switch_time_t | input, | |||
| switch_int32_t | offs | |||
| ) |
convert a time to its human readable components in a specific timezone with offset
| result | the exploded time | |
| input | the time to explode |
Definition at line 345 of file switch_apr.c.
Referenced by switch_xml_std_datetime_check().
| switch_time_t switch_time_make | ( | switch_time_t | sec, | |
| int32_t | usec | |||
| ) |
Definition at line 360 of file switch_apr.c.
00361 { 00362 return ((switch_time_t) (sec) * APR_USEC_PER_SEC + (switch_time_t) (usec)); 00363 }
| switch_time_t switch_time_now | ( | void | ) |
Definition at line 319 of file switch_apr.c.
Referenced by rtp_common_write(), switch_channel_clear_flag(), switch_channel_set_flag_value(), switch_core_init(), switch_core_session_exec(), switch_ivr_dmachine_check_timeout(), switch_ivr_dmachine_feed(), switch_micro_time_now(), SWITCH_MODULE_RUNTIME_FUNCTION(), switch_time_sync(), and time_now().
00320 { 00321 #if defined(HAVE_CLOCK_GETTIME) && defined(SWITCH_USE_CLOCK_FUNCS) 00322 struct timespec ts; 00323 clock_gettime(CLOCK_REALTIME, &ts); 00324 return ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec / 1000); 00325 #else 00326 return (switch_time_t) apr_time_now(); 00327 #endif 00328 }
1.4.7