![]() ![]() Please be more careful to post accurate information. M returns the age of a file (at the point when the Perl program was started) in days. If only 6 groups are used, the 6th capture (seconds) will be checked for a fraction. You need to See perldoc -f -X to learn about all of the file tests yourself. If you're doing something more complex you probably ought to be using one of the modules listed in "SEE ALSO".Īn optional 7th group can be used to capture the fractional seconds. 04-01-2008 biswajeet. The pattern must capture 6 groups in the appropriate order: year, month, day, hour, minute, second. The default pattern will match any of the named formats. If the stamp doesn't match the pattern the function will return undef in scalar context or an empty list in list context.Īn alternate regular expression can be supplied as the regexp parameter during import. Besides Time::Local only takes the first 6 anyway. ![]() NOTE that the wday, yday, and isdst parameters (the last three elements returned from localtime or gmtime) are not returned because they are not easily determined from the stamp. What Im getting is a strange appended to the time stamp for a logfile. Just an idea: maybe youre on top of a virtualization. k-den This is strange - I can test on the exactly same perl/OS combination (system perl on Ubuntu 20.04), and it still works as expected. ![]() By way of example, heres a little program that copies the read and. Im trying to add a datestamp to my output files using perl. I dont get any syntax errors, but the milliseconds are always coming out to 000 for me, on Perl 5.30.0/Ubuntu 20. Solution Use stat to get those times and utime to set them. In list context they return the list that would have been sent to Time::Local which is similar to the one returned by gmtime and localtime: seconds, minutes, hours, day, month (0-11), year (-1900). You use the utime function documented in utime. Getting and Setting Timestamps Problem You need to retrieve or alter when a file was last modified (written or changed) or accessed (read). They accept a timestamp and use the appropriate function from Time::Local to turn it back into a seconds-since-epoch integer. The parser functions are the inverse of the stamp functions. Version 1.300 SYNOPSIS # import customized functions to make easy-to-use timestamps Time::Stamp - Easy, readable, efficient timestamp functions VERSION ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |