public static void RecordToFile(double dn, IntPtr time, IntPtr data, string file)
        {
            int n = (int)dn;

            hcltime_t[] t = new hcltime_t[n];
            for (int i = 0; i < n; i++, time = new IntPtr(time.ToInt32() + Marshal.SizeOf(typeof(hcltime_t))))
            {
                t[i] = Marshal.PtrToStructure <hcltime_t>(time);
            }
            double[] d = new double[n];
            for (int i = 0; i < n; i++, data = new IntPtr(data.ToInt32() + Marshal.SizeOf(typeof(double))))
            {
                d[i] = Marshal.PtrToStructure <double>(data);
            }
            using (StreamWriter writer = new StreamWriter(file))
            {
                DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
                for (int i = 0; i < n; i++)
                {
                    writer.WriteLine(string.Format("{0}\t{1}",
                                                   new DateTime(1970, 1, 1).AddSeconds(t[i].time).ToString("yy/MM/dd\tHH:mm:ss.ff", dtFormat), d[i]));
                }
            }
        }
 public static extern void hcltime2epoch(hcltime_t time, ref double year, ref double month, ref double day, ref double hour, ref double min, ref double sec);