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

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

Issue 2090713003: Make callers of FromUTC(Local)Exploded in net/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert Created 4 years, 2 months 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
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_vms.h" 5 #include "net/ftp/ftp_directory_listing_parser_vms.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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 base::SplitStringPiece(time_column, base::ASCIIToUTF16(":"), 186 base::SplitStringPiece(time_column, base::ASCIIToUTF16(":"),
187 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 187 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
188 if (time_parts.size() != 2) 188 if (time_parts.size() != 2)
189 return false; 189 return false;
190 if (!base::StringToInt(time_parts[0], &time_exploded.hour)) 190 if (!base::StringToInt(time_parts[0], &time_exploded.hour))
191 return false; 191 return false;
192 if (!base::StringToInt(time_parts[1], &time_exploded.minute)) 192 if (!base::StringToInt(time_parts[1], &time_exploded.minute))
193 return false; 193 return false;
194 194
195 // We don't know the time zone of the server, so just use local time. 195 // We don't know the time zone of the server, so just use local time.
196 *time = base::Time::FromLocalExploded(time_exploded); 196 return base::Time::FromLocalExploded(time_exploded, time);
197 return true;
198 } 197 }
199 198
200 } // namespace 199 } // namespace
201 200
202 bool ParseFtpDirectoryListingVms( 201 bool ParseFtpDirectoryListingVms(
203 const std::vector<base::string16>& lines, 202 const std::vector<base::string16>& lines,
204 std::vector<FtpDirectoryListingEntry>* entries) { 203 std::vector<FtpDirectoryListingEntry>* entries) {
205 // The first non-empty line is the listing header. It often 204 // The first non-empty line is the listing header. It often
206 // starts with "Directory ", but not always. We set a flag after 205 // starts with "Directory ", but not always. We set a flag after
207 // seing the header. 206 // seing the header.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 entries->push_back(entry); 294 entries->push_back(entry);
296 } 295 }
297 296
298 // The only place where we return true is after receiving the "Total" line, 297 // The only place where we return true is after receiving the "Total" line,
299 // that should be present in every VMS listing. Alternatively, if the listing 298 // that should be present in every VMS listing. Alternatively, if the listing
300 // contains error messages, it's OK not to have the "Total" line. 299 // contains error messages, it's OK not to have the "Total" line.
301 return seen_error; 300 return seen_error;
302 } 301 }
303 302
304 } // namespace net 303 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698