35 lines
1023 B
C#
35 lines
1023 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace skyscraper5.LyngsatMapsScraper.Model
|
|
{
|
|
public class IndexJsonKml
|
|
{
|
|
public string id;
|
|
public string name;
|
|
public string satpos;
|
|
public string beams_process_timestamp;
|
|
public string url;
|
|
|
|
public SaneSatellitePointer Sanitize()
|
|
{
|
|
return new SaneSatellitePointer(Int32.Parse(id), name, float.Parse(satpos,CultureInfo.InvariantCulture), UnixTimeStampToDateTime(Int64.Parse(beams_process_timestamp)));
|
|
}
|
|
|
|
//stolen from https://stackoverflow.com/a/250400
|
|
private static DateTime UnixTimeStampToDateTime(long unixTimeStamp)
|
|
{
|
|
// Unix timestamp is seconds past epoch
|
|
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
|
dateTime = dateTime.AddSeconds(unixTimeStamp).ToLocalTime();
|
|
return dateTime;
|
|
}
|
|
}
|
|
|
|
public record SaneSatellitePointer(int id, string name, float satpos, DateTime beamsProcessTimestamp);
|
|
}
|