test.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import datetime
  2. import time
  3. from datetime import timezone, timedelta, datetime
  4. import boto3
  5. from AnsjerPush.config import AWS_SES_ACCESS_ID, AWS_SES_ACCESS_SECRET
  6. # client = boto3.client('cloudwatch', region_name='us-east-1', aws_access_key_id=AWS_SES_ACCESS_ID, aws_secret_access_key=AWS_SES_ACCESS_SECRET)
  7. # response = client.get_dashboard(DashboardName='string')
  8. # print(response)
  9. # localtime = time.localtime(1601482210)
  10. # current_month = localtime.tm_mon
  11. # print(current_month)
  12. #
  13. # time_struct = [localtime.tm_year, localtime.tm_mon, 1, 0, 0, 0, 0, 0, 0]
  14. # start_time = int(time.mktime(tuple(time_struct)))
  15. # print(start_time)
  16. #
  17. # time_struct[1] = current_month + 1
  18. # end_time = int(time.mktime(tuple(time_struct)))
  19. # print(end_time)
  20. # current_time = int(1601565010 - 8 * 3600)
  21. # print(current_time)
  22. # count = int(current_time / (24 * 3600))
  23. # current_time = count * 24 * 3600
  24. # print(current_time)
  25. # localtime = time.localtime(1601565010)
  26. # datetime.datetime()
  27. # current_day = localtime.tm_mday
  28. #
  29. # time_struct = [localtime.tm_year, localtime.tm_mon, current_day, 0, 0, 0, 0, 0, 0]
  30. # current_time = int(time.mktime(tuple(time_struct)))
  31. # print(current_time)
  32. # gmtime = time.gmtime(1601568621 + 28800)
  33. # current_day = gmtime.tm_mday
  34. # print(current_day)
  35. # print(gmtime.tm_hour)
  36. # time_struct = [gmtime.tm_year, gmtime.tm_mon, current_day, 0, 0, 0, 0, 0, 0]
  37. # current_time = int(time.mktime(tuple(time_struct)))
  38. # print(current_time - 28800)
  39. gmtime = time.gmtime(int(time.time()) + 28800)
  40. current_month = gmtime.tm_mon - 1
  41. print(current_month)
  42. time_struct = [gmtime.tm_year, current_month, 1, 0, 0, 0, 0, 0, gmtime.tm_isdst]
  43. start_time = int(time.mktime(tuple(time_struct))) - 28800
  44. print(start_time)
  45. time_struct[1] = current_month + 1
  46. end_time = int(time.mktime(tuple(time_struct))) - 28800
  47. print(end_time)