Changeset fdc160c


Ignore:
Timestamp:
Dec 6, 2015 4:28:14 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
826bb54
Parents:
5a7fc3f
Message:

Utils: Move new getSystemTimeZone() from DataHelper? to SystemVersion?,
which is a better place for it.

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r5a7fc3f rfdc160c  
    3232import net.i2p.util.Log;
    3333import net.i2p.util.SecureFile;
     34import net.i2p.util.SystemVersion;
    3435import net.i2p.util.Translate;
    3536
     
    28032804                long dat = meta.getCreationDate();
    28042805                SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    2805                 fmt.setTimeZone(DataHelper.getSystemTimeZone(_context));
     2806                fmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
    28062807                if (dat > 0) {
    28072808                    String date = fmt.format(new Date(dat));
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ConnThrottler.java

    r5a7fc3f rfdc160c  
    99import java.util.Map;
    1010
    11 import net.i2p.I2PAppContext;
    1211import net.i2p.data.DataHelper;
    1312import net.i2p.data.Hash;
     
    1514import net.i2p.util.Log;
    1615import net.i2p.util.SimpleTimer2;
     16import net.i2p.util.SystemVersion;
    1717
    1818/**
     
    5757        // for logging
    5858        _fmt = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
    59         _fmt.setTimeZone(DataHelper.getSystemTimeZone(I2PAppContext.getGlobalContext()));
     59        _fmt.setTimeZone(SystemVersion.getSystemTimeZone());
    6060        new Cleaner();
    6161    }
  • apps/routerconsole/java/src/net/i2p/router/news/NewsManager.java

    r5a7fc3f rfdc160c  
    2020import net.i2p.util.FileUtil;
    2121import net.i2p.util.Log;
     22import net.i2p.util.SystemVersion;
    2223import net.i2p.util.TranslateReader;
    2324
     
    234235                    DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT);
    235236                    // the router sets the JVM time zone to UTC but saves the original here so we can get it
    236                     fmt.setTimeZone(DataHelper.getSystemTimeZone(_context));
     237                    fmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
    237238                    try {
    238239                        Date date = fmt.parse(newsContent.substring(0, colon));
  • apps/routerconsole/java/src/net/i2p/router/update/NewsFetcher.java

    r5a7fc3f rfdc160c  
    4444import net.i2p.util.SecureFileOutputStream;
    4545import net.i2p.util.SSLEepGet;
     46import net.i2p.util.SystemVersion;
    4647import net.i2p.util.Translate;
    4748import net.i2p.util.VersionComparator;
     
    590591            DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT);
    591592            // the router sets the JVM time zone to UTC but saves the original here so we can get it
    592             fmt.setTimeZone(DataHelper.getSystemTimeZone(_context));
     593            fmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
    593594            for (NewsEntry e : entries) {
    594595                if (e.title == null || e.content == null)
  • apps/routerconsole/java/src/net/i2p/router/web/EventLogHelper.java

    r5a7fc3f rfdc160c  
    1717import net.i2p.data.DataHelper;
    1818import net.i2p.router.util.EventLog;
     19import net.i2p.util.SystemVersion;
    1920
    2021/**
     
    189190        SimpleDateFormat fmt = (SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
    190191        // the router sets the JVM time zone to UTC but saves the original here so we can get it
    191         fmt.setTimeZone(DataHelper.getSystemTimeZone(_context));
     192        fmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
    192193
    193194        List<Map.Entry<Long, String>> entries = new ArrayList<Map.Entry<Long, String>>(events.entrySet());
  • apps/routerconsole/java/src/net/i2p/router/web/NewsFeedHelper.java

    r5a7fc3f rfdc160c  
    1111import net.i2p.router.news.NewsEntry;
    1212import net.i2p.router.news.NewsManager;
     13import net.i2p.util.SystemVersion;
    1314
    1415
     
    5657            DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT);
    5758            // the router sets the JVM time zone to UTC but saves the original here so we can get it
    58             fmt.setTimeZone(DataHelper.getSystemTimeZone(ctx));
     59            fmt.setTimeZone(SystemVersion.getSystemTimeZone(ctx));
    5960            int i = 0;
    6061            for (NewsEntry entry : entries) {
  • apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java

    r5a7fc3f rfdc160c  
    634634                DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT);
    635635                // the router sets the JVM time zone to UTC but saves the original here so we can get it
    636                 fmt.setTimeZone(DataHelper.getSystemTimeZone(_context));
     636                fmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
    637637                int i = 0;
    638638                final int max = 2;
  • apps/susidns/src/java/src/i2p/susi/dns/FormatDate.java

    r5a7fc3f rfdc160c  
    44import java.text.DateFormat;
    55
    6 import net.i2p.I2PAppContext;
    7 import net.i2p.data.DataHelper;
     6import net.i2p.util.SystemVersion;
    87
    98/**
     
    1817        DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
    1918        // the router sets the JVM time zone to UTC but saves the original here so we can get it
    20         fmt.setTimeZone(DataHelper.getSystemTimeZone(I2PAppContext.getGlobalContext()));
     19        fmt.setTimeZone(SystemVersion.getSystemTimeZone());
    2120        _dateFormat = fmt;
    2221    }
  • apps/susimail/src/src/i2p/susi/webmail/Mail.java

    r5a7fc3f rfdc160c  
    4242import java.util.TimeZone;
    4343
    44 import net.i2p.I2PAppContext;
    4544import net.i2p.data.DataHelper;
     45import net.i2p.util.SystemVersion;
    4646
    4747/**
     
    277277                DateFormat longLocalDateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
    278278                // the router sets the JVM time zone to UTC but saves the original here so we can get it
    279                 TimeZone tz = DataHelper.getSystemTimeZone(I2PAppContext.getGlobalContext());
     279                TimeZone tz = SystemVersion.getSystemTimeZone();
    280280                localDateFormatter.setTimeZone(tz);
    281281                longLocalDateFormatter.setTimeZone(tz);
  • core/java/src/net/i2p/data/DataHelper.java

    r5a7fc3f rfdc160c  
    3838import java.util.Map;
    3939import java.util.Properties;
    40 import java.util.TimeZone;
    4140import java.util.concurrent.ConcurrentHashMap;
    4241import java.util.regex.Pattern;
     
    19261925        return p.split(s, limit);
    19271926    }
    1928 
    1929     /**
    1930      *  The system's time zone, which is probably different from the
    1931      *  JVM time zone, because Router changes the JVM default to GMT.
    1932      *  It saves the old default in the context properties where we can get it.
    1933      *  Use this to format a time in local time zone with DateFormat.setTimeZone().
    1934      *
    1935      *  @return non-null
    1936      *  @since 0.9.24
    1937      */
    1938     public static TimeZone getSystemTimeZone(I2PAppContext ctx) {
    1939         String systemTimeZone = ctx.getProperty("i2p.systemTimeZone");
    1940         if (systemTimeZone != null)
    1941             return TimeZone.getTimeZone(systemTimeZone);
    1942         return TimeZone.getDefault();
    1943     }
    19441927}
  • core/java/src/net/i2p/util/LogManager.java

    r5a7fc3f rfdc160c  
    479479                fmt.applyPattern(format);
    480480            // the router sets the JVM time zone to UTC but saves the original here so we can get it
    481             fmt.setTimeZone(DataHelper.getSystemTimeZone(_context));
     481            fmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
    482482            _dateFormatPattern = format;
    483483            _dateFormat = fmt;
  • core/java/src/net/i2p/util/SystemVersion.java

    r5a7fc3f rfdc160c  
    66
    77import java.lang.reflect.Field;
     8import java.util.TimeZone;
     9
     10import net.i2p.I2PAppContext;
    811
    912/**
     
    203206        return maxMemory;
    204207    }
     208
     209    /**
     210     *  The system's time zone, which is probably different from the
     211     *  JVM time zone, because Router changes the JVM default to GMT.
     212     *  It saves the old default in the context properties where we can get it.
     213     *  Use this to format a time in local time zone with DateFormat.setTimeZone().
     214     *
     215     *  @return non-null
     216     *  @since 0.9.24
     217     */
     218    public static TimeZone getSystemTimeZone() {
     219        return getSystemTimeZone(I2PAppContext.getGlobalContext());
     220    }
     221
     222    /**
     223     *  The system's time zone, which is probably different from the
     224     *  JVM time zone, because Router changes the JVM default to GMT.
     225     *  It saves the old default in the context properties where we can get it.
     226     *  Use this to format a time in local time zone with DateFormat.setTimeZone().
     227     *
     228     *  @return non-null
     229     *  @since 0.9.24
     230     */
     231    public static TimeZone getSystemTimeZone(I2PAppContext ctx) {
     232        String systemTimeZone = ctx.getProperty("i2p.systemTimeZone");
     233        if (systemTimeZone != null)
     234            return TimeZone.getTimeZone(systemTimeZone);
     235        return TimeZone.getDefault();
     236    }
     237
     238    /**
     239     *  @since 0.9.24
     240     */
     241/****
     242    public static void main(String[] args) {
     243        System.out.println("64 bit   : " + is64Bit());
     244        System.out.println("Java 6   : " + isJava6());
     245        System.out.println("Java 7   : " + isJava7());
     246        System.out.println("Java 8   : " + isJava8());
     247        System.out.println("Java 9   : " + isJava9());
     248        System.out.println("Android  : " + isAndroid());
     249        if (isAndroid())
     250            System.out.println("  Version: " + getAndroidVersion());
     251        System.out.println("Apache   : " + isApache());
     252        System.out.println("ARM      : " + isARM());
     253        System.out.println("Mac      : " + isMac());
     254        System.out.println("Gentoo   : " + isGentoo());
     255        System.out.println("GNU      : " + isGNU());
     256        System.out.println("Windows  : " + isWindows());
     257        System.out.println("Wrapper  : " + hasWrapper());
     258        System.out.println("x86      : " + isX86());
     259        System.out.println("Max mem  : " + getMaxMemory());
     260
     261    }
     262****/
    205263}
Note: See TracChangeset for help on using the changeset viewer.