File tree 1 file changed +16
-3
lines changed
Filter options
1 file changed +16
-3
lines changed
Original file line number Diff line number Diff line change @@ -115,24 +115,37 @@ Directory :: Directory (const std::string& path) {
115
115
struct stat info{};
116
116
stat (i.path ().c_str (), &info);
117
117
struct group *gr = getgrgid (info.st_gid );
118
- struct tm * created = localtime (( const time_t *) info.st_ctime );
118
+ auto created = posix2time ( info.st_ctime );
119
119
struct passwd *user = getpwuid (info.st_uid );
120
120
121
+ std::tm *gat = std::gmtime (&created);
122
+ std::stringstream buff;
123
+ buff << std::put_time (gat, " %A, %d %B %Y %H:%M" );
124
+ std::string created_format = buff.str ();
125
+
121
126
std::time_t tt = decltype (i.last_write_time ())::clock ::to_time_t (i.last_write_time ());
122
127
std::tm *gmt = std::gmtime (&tt);
123
128
std::stringstream buffer;
124
129
buffer << std::put_time (gmt, " %A, %d %B %Y %H:%M" );
125
130
std::string modified_formatted = buffer.str ();
126
131
132
+ std::string file_size;
133
+
134
+ if (i.is_directory ()) {
135
+ file_size.append (std::to_string (i.file_size ()));
136
+ } else {
137
+ file_size.append (grey (" -" ));
138
+ }
139
+
127
140
paths_h.emplace_back (
128
141
File (
129
142
i,
130
143
meta_types,
131
144
gr->gr_name ,
132
145
user->pw_name ,
133
146
modified_formatted,
134
- std::to_string (created-> tm_year ) ,
135
- std::to_string (i. file_size ()) ,
147
+ created_format ,
148
+ file_size,
136
149
color_and_format_perms (fs::status (i.path ()).permissions ())
137
150
)
138
151
);
You can’t perform that action at this time.
0 commit comments