4 ms·
You might be amused to browse Chrome's implementation of FTP, which has separate modules for each of the different types of FTP servers you might encounter, as
by evmar 15y ago
You might be amused to browse Chrome's implementation of FTP, which has separate modules for each of the different types of FTP servers you might encounter, as each emits the "ls -l" output in a different way and that is (I guess) the only way to get file sizes.
http://git.chromium.org/gitweb/?p=chromium.git;a=tree;f=net/ftp;h=a9ccad9efc957926f20f8825a4ffc95c24673729;hb=HEAD http://git.chromium.org/gitweb/?p=chromium.git;a=tree;f=net/...
see all the "directory listing" files.
The unit tests are full of scary cases like
// Tests for "ls -l" style listing in Russian locale (note the swapped
// parts order: the day of month is the first, before month).
- toyg 15y agoThat's actually the standard European order. Testing the Russian locale might be a scary proposition, but certainly not for this specific reason.
- sjwright 15y agoIt's not just the standard European order, it's the standard order for nearly everywhere on the planet except: > MDY: Belize, USA, parts of Canada, Philippines, Saudi Arabia > YMD: Japan, China, Iran, small bits of Europe > DMY: Probably 3/4 of the planet's land surface That said, YMD should make the most sense (and is most consistent with the universally accepted HMS time format). I try to use YMD wherever I can.
- reitzensteinm 15y agoYMD is logical, because it puts the most significant number on the left. But both DMY and HMS are consistent in another way - the information is ordered from most to least important for every day access, from left to right. A vast majority of dates on advertising, tickets, timetables etc actually leave off the year, unless it's ambiguous. Similarly, one might say something like 'on the 4th', which implies 'the 4th of this month' (or the 4th of next month, if applicable). This is the reverse of HMS, where the most significant number (the hour) is most important, and seconds are basically ignored day to day. MDY, on the other hand, should be taken out the back and shot (IMO).
- wvenable 15y ago> the information is ordered from most to least important for every day access I argue that MDY is ordered from most to least important for every day access. Year is easily implied so it is last so that leaves month first and then day. You'd be surprised how many Canadians, which is officially DMY, actually prefer MDY.
- eslaught 15y agoIn my opinion YMD is the most useful because it is the most visually distinct from the other two. A date like January 2nd 2012, when arranged in either MDY or DMY format, is difficult to distinguish from February 1st. YMD on the other hand is obvious, independent of what the reader is used to.
- trebor 15y agoMDY is syntactically correct English: January 30th, 2012. Or in older form (where it would have come from): "Dated: January the 30th, in the year of our Lord 2012." Even the US Constitution is dated this way. I strongly prefer this way because it makes the most sense in the English language. For programmatic sorting YMD makes sense because is automatically sorts by Y, M, D, if compared as a string. (EG: on a filesystem.)
- sunchild 15y agoAbsent any date-format-aware sort controller: YMD will group results by year, then month, then day. MDY will group results by month, then day, then year. DMY will group results by day, then month, then year. That's why all my filenames look like: YYYY_MM_DD_filename.suffix
- sjwright 15y ago[edited because I realized we're in violent agreement] To me, MDY makes as much sense as writing pi as 14.3.159265
- reitzensteinm 15y agoI might be missing something, but that's not at all what I was arguing! MDY drives me nuts too.
- toyg 15y agoHere's a nice stimulus bill for the US economy: mandatory switch from MDY to DMY. That should keep "a few" programmers busy for years! I'm not joking, that's how you move the economy: it's the digital equivalent of building a new bridge. (It'd be more forward-thinking to actually switch to YMD, but I can imagine the reactions at the idea of aligning with Iran and China.)
- ajuc 15y agoIn my country YMD and DMY are used, and I don't see, which is more prevalent. And some people use "." some use "/" and some use "-" as separators. It doesn't seem to cause any problems. You just need to validate inputs (best - show example as the default value), and know which foramt you use. But MDY is just ugly and should die. It's almost as strange, as German way of saying 123. One hundert, three, and twenty :) Who invented this. EDIT: didn't wanted to insult Germans :)
- dchest 15y agoThe comment says "Russian" because they really test the month name in Russian: "23 май 2011". -rwxrwxr-x 1 ftp ftp 123 23 \xd0\xbc\xd0\xb0\xd0\xb9 2011 test The note about day, month order is useful because all other tests have "%b %e" format and rows are full of other numbers: drwxr-xr-x1732 266 111 90112 Jun 21 2001 .rda_2 http://git.chromium.org/gitweb/?p=chromium.git;a=blob;f=net/ftp/ftp_directory_listing_parser_ls_unittest.cc;h=b14d5c075a9fa6d65d58377139c7f7aadba5e9fa;hb=HEAD#l103 http://git.chromium.org/gitweb/?p=chromium.git;a=blob;f=net/...