Changeset c27aed3


Ignore:
Timestamp:
Aug 25, 2005 9:07:18 PM (15 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
e0bfdff
Parents:
cdc6002
git-author:
jrandom <jrandom> (08/25/05 21:07:18)
git-committer:
zzz <zzz@…> (08/25/05 21:07:18)
Message:

fix up the entryId calc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/syndie/java/src/net/i2p/syndie/BlogManager.java

    rcdc6002 rc27aed3  
    22
    33import java.io.*;
     4import java.text.*;
    45import java.util.*;
    56import net.i2p.I2PAppContext;
     
    416417        return "eep".equals(schema) || "i2p".equals(schema);
    417418    }
    418    
    419     private final GregorianCalendar _cal = new GregorianCalendar();
    420     private long getDayBegin(long now) {
    421         synchronized (_cal) {
    422             _cal.setTimeInMillis(now);
    423             _cal.set(Calendar.MILLISECOND, 0);
    424             _cal.set(Calendar.SECOND, 0);
    425             _cal.set(Calendar.MINUTE, 0);
    426             _cal.set(Calendar.HOUR, 0);
    427             _cal.set(Calendar.HOUR_OF_DAY, 0);
    428             return _cal.getTimeInMillis();
     419
     420    private final SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.UK);   
     421    private final long getDayBegin(long now) {
     422        synchronized (_dateFormat) {
     423            try {
     424                String str = _dateFormat.format(new Date(now));
     425                return _dateFormat.parse(str).getTime();
     426            } catch (ParseException pe) {
     427                pe.printStackTrace();
     428                // wtf
     429                return -1;
     430            }
    429431        }
    430432    }
Note: See TracChangeset for help on using the changeset viewer.