test_topline_summary.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:python_mozetl 作者: mozilla 项目源码 文件源码
def generate_dates(submission_date_s3, ts_offset=0, creation_offset=0):
    # convert submission_date into profile_creation_date and timestamps
    submission = arrow.get(submission_date_s3, "YYYYMMDD")
    creation = submission.replace(days=+creation_offset)
    timestamp = submission.replace(days=+ts_offset)

    # variables for conversion
    epoch = arrow.get(0)
    seconds_per_day = topline.seconds_per_day
    nanoseconds_per_second = 10**9

    date_snippet = {
        "submission_date_s3": submission_date_s3,
        "profile_creation_date": (
            long((creation - epoch).total_seconds() / seconds_per_day)
        ),
        "timestamp": (
            long((timestamp - epoch).total_seconds() * nanoseconds_per_second)
        )
    }

    return date_snippet
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号