function periodAt(uint _blockTimestamp) constant returns(uint) {
        
        if (startBlockTimestamp > _blockTimestamp)
            return 0;

        
        uint p = ((_blockTimestamp - startBlockTimestamp) / intervalSecs) + 1;
        if (p > periods)
            p = periods;
        return p;
    }