OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/ftp/ftp_util.h" | 5 #include "net/ftp/ftp_util.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 return false; | 326 return false; |
327 if (!base::StringToInt(time_parts[1], &time_exploded.minute)) | 327 if (!base::StringToInt(time_parts[1], &time_exploded.minute)) |
328 return false; | 328 return false; |
329 if (!time_exploded.HasValidValues()) | 329 if (!time_exploded.HasValidValues()) |
330 return false; | 330 return false; |
331 | 331 |
332 if (time.length() > 5) { | 332 if (time.length() > 5) { |
333 if (time.length() != 7) | 333 if (time.length() != 7) |
334 return false; | 334 return false; |
335 base::string16 am_or_pm(time.substr(5, 2)); | 335 base::string16 am_or_pm(time.substr(5, 2)); |
336 if (EqualsASCII(am_or_pm, "PM")) { | 336 if (base::EqualsASCII(am_or_pm, "PM")) { |
337 if (time_exploded.hour < 12) | 337 if (time_exploded.hour < 12) |
338 time_exploded.hour += 12; | 338 time_exploded.hour += 12; |
339 } else if (EqualsASCII(am_or_pm, "AM")) { | 339 } else if (base::EqualsASCII(am_or_pm, "AM")) { |
340 if (time_exploded.hour == 12) | 340 if (time_exploded.hour == 12) |
341 time_exploded.hour = 0; | 341 time_exploded.hour = 0; |
342 } else { | 342 } else { |
343 return false; | 343 return false; |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 // We don't know the time zone of the server, so just use local time. | 347 // We don't know the time zone of the server, so just use local time. |
348 *result = base::Time::FromLocalExploded(time_exploded); | 348 *result = base::Time::FromLocalExploded(time_exploded); |
349 return true; | 349 return true; |
(...skipping 14 matching lines...) Expand all Loading... |
364 while (!iter.end() && !u_isspace(iter.get())) | 364 while (!iter.end() && !u_isspace(iter.get())) |
365 iter.Advance(); | 365 iter.Advance(); |
366 } | 366 } |
367 | 367 |
368 base::string16 result(text.substr(iter.array_pos())); | 368 base::string16 result(text.substr(iter.array_pos())); |
369 base::TrimWhitespace(result, base::TRIM_ALL, &result); | 369 base::TrimWhitespace(result, base::TRIM_ALL, &result); |
370 return result; | 370 return result; |
371 } | 371 } |
372 | 372 |
373 } // namespace | 373 } // namespace |
OLD | NEW |