126{
127 double x = 0.0;
128 long sec = 0L;
129 char timestr[64];
131 struct timeval when = {0,};
132 int res;
133
134 if (!chan)
135 return -1;
136
137 if (!data) {
139 return -1;
140 }
141
143 return -1;
144
145 res = sscanf(
value,
"%30ld%30lf", &sec, &x);
146 if (res == 0 || sec < 0) {
147 when.tv_sec = 0;
148 when.tv_usec = 0;
149 } else if (res == 1) {
150 when.tv_sec = sec;
151 } else if (res == 2) {
152 when.tv_sec = sec;
153 when.tv_usec = x * 1000000;
154 }
155
156 switch (*data) {
157 case 'a':
158 case 'A':
165 ast_strftime(timestr,
sizeof(timestr),
"%Y-%m-%d %H:%M:%S.%3q %Z",
167 ast_verb(3,
"Channel will hangup at %s.\n", timestr);
168 } else {
169 ast_verb(3,
"Channel hangup cancelled.\n");
170 }
171 }
172 break;
173
174 case 'r':
175 case 'R':
179 }
180 break;
181
182 case 'd':
183 case 'D':
187 }
188 break;
189
190 default:
192 break;
193 }
194
195 return 0;
196}
#define ast_channel_lock(chan)
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
#define ast_channel_unlock(chan)
#define VERBOSITY_ATLEAST(level)
#define ast_verb(level,...)
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.