Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: net/ftp/ftp_directory_listing_parser_ls.cc

Issue 2558143003: Use UTC rather than local time for interpreting FTP listing dates. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/ftp/ftp_directory_listing_parser_unittest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_directory_listing_parser_ls.h" 5 #include "net/ftp/ftp_directory_listing_parser_ls.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 base::SPLIT_WANT_ALL); 45 base::SPLIT_WANT_ALL);
46 if (time_parts.size() != 2) 46 if (time_parts.size() != 2)
47 return false; 47 return false;
48 if (!base::StringToInt(time_parts[0], &time_exploded.hour)) 48 if (!base::StringToInt(time_parts[0], &time_exploded.hour))
49 return false; 49 return false;
50 if (!base::StringToInt(time_parts[1], &time_exploded.minute)) 50 if (!base::StringToInt(time_parts[1], &time_exploded.minute))
51 return false; 51 return false;
52 if (!time_exploded.HasValidValues()) 52 if (!time_exploded.HasValidValues())
53 return false; 53 return false;
54 54
55 // We don't know the time zone of the server, so just use local time. 55 // We don't know the time zone of the server, so just use UTC.
56 *result = base::Time::FromLocalExploded(time_exploded); 56 *result = base::Time::FromUTCExploded(time_exploded);
57 return true; 57 return true;
58 } 58 }
59 59
60 // Returns the column index of the end of the date listing and detected 60 // Returns the column index of the end of the date listing and detected
61 // last modification time. 61 // last modification time.
62 bool DetectColumnOffsetSizeAndModificationTime( 62 bool DetectColumnOffsetSizeAndModificationTime(
63 const std::vector<base::string16>& columns, 63 const std::vector<base::string16>& columns,
64 const base::Time& current_time, 64 const base::Time& current_time,
65 size_t* offset, 65 size_t* offset,
66 base::string16* size, 66 base::string16* size,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 entry.name = entry.name.substr(0, pos); 222 entry.name = entry.name.substr(0, pos);
223 } 223 }
224 224
225 entries->push_back(entry); 225 entries->push_back(entry);
226 } 226 }
227 227
228 return true; 228 return true;
229 } 229 }
230 230
231 } // namespace net 231 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/ftp/ftp_directory_listing_parser_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698