NetGuard/app/src/main/java/eu/faircode/netguard/ResourceRecord.java

48 lines
1.4 KiB
Java
Raw Normal View History

2016-01-30 08:51:41 +00:00
package eu.faircode.netguard;
/*
This file is part of NetGuard.
NetGuard is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
NetGuard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with NetGuard. If not, see <http://www.gnu.org/licenses/>.
2018-12-31 16:12:49 +00:00
Copyright 2015-2019 by Marcel Bokhorst (M66B)
2016-01-30 08:51:41 +00:00
*/
2016-01-30 09:59:19 +00:00
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
2016-01-30 08:51:41 +00:00
public class ResourceRecord {
2016-01-30 09:59:19 +00:00
public long Time;
2016-01-30 08:51:41 +00:00
public String QName;
public String AName;
public String Resource;
public int TTL;
2016-02-15 16:48:53 +00:00
2016-02-03 15:51:01 +00:00
private static DateFormat formatter = SimpleDateFormat.getDateTimeInstance();
2016-01-30 08:51:41 +00:00
public ResourceRecord() {
}
@Override
public String toString() {
2016-02-15 16:48:53 +00:00
return formatter.format(new Date(Time).getTime()) +
2016-01-30 09:59:19 +00:00
" Q " + QName +
" A " + AName +
" R " + Resource +
" TTL " + TTL +
2016-02-03 15:51:01 +00:00
" " + formatter.format(new Date(Time + TTL * 1000L).getTime());
2016-01-30 08:51:41 +00:00
}
}