in reply to Re: localtime function
in thread localtime function

In this case the print line may look like this in my comment above:
print localtime(int($t/1000)) . ' (' . sprintf("%03d", ($t % 1000)) . + "ms)\n";

Replies are listed 'Best First'.
Re^3: localtime function
by rsodhia (Novice) on Jan 28, 2015 at 04:43 UTC

    Here's my Input file: sourceIP geographic startTime endTime sourcePort 192.168.0.123 Other 1.42E+12 1.42E+12 61077 115.239.228.15 Asia.China 1.42E+12 1.42E+12 47308 74.125.206.188 NorthAmerica.UnitedStates 1.42E+12 1.42E+12 5228 92.51.156.102 Europe.Germany 1.42E+12 1.42E+12 5938 1.1.1.1 Oceania.Australia 1.42E+12 1.42E+12 N/A 201.48.158.12 SouthAmerica.Brazil 1.42E+12 1.42E+12 34290 64.233.167.188 NorthAmerica.UnitedStates 1.42E+12 1.42E+12 5228 50.87.144.182 NorthAmerica.UnitedStates 1.42E+12 1.42E+12 2096 180.222.178.177 Asia.Japan 1.42E+12 1.42E+12 48264 54.161.79.163 NorthAmerica.UnitedStates 1.42E+12 1.42E+12 8576 1.1.1.2 Oceania.Australia 1.42E+12 1.42E+12 123 172.16.16.100 Other 1.42E+12 1.42E+12 138

    THe whole input is getting into array while I want the data part only to play with leaving the header fields as it is.

      Please read localtime.

      Would you share a few lines of your input file?

      Without knowing what your input file exactly looks like, I can only guess that the problem is that you've got "invalid" time values in there that you might want to filter out or fix when converting.

      localtime() is taking starttime as a string & converting it to a default date

      Yes, that is what localtime does. What is the problem?

      You still haven't shown us: a representative sample of your input (i.e. a properly formatted copy-paste of the input file including those lines that cause the problem), your exact expected output; also your posts still aren't formatted properly.

      Please take the time to read, understand and follow How do I post a question effectively? - help us to help you and you will find your questions can be answered much better and faster.