Replace use of ctime_r() with strftime()
Fix bug: packt size of non-last fragmetns must be a multiple of 8